in0finite / SanAndreasUnity

Open source reimplementation of GTA San Andreas game engine in Unity
https://discord.gg/p6jjud5
MIT License
2.15k stars 353 forks source link

Import gxt #23

Closed lexnewgate closed 5 years ago

lexnewgate commented 5 years ago

22

I have integrated the none-ui part. You can test it by uncomment the following code in GXTWindow.cs.

 protected override void OnWindowOpened()
        {
            base.OnWindowOpened();
            //foreach (var kv in GTX.Gtx.EntryNameWordDict)
            //{
               // Debug.LogError($"k {kv.Key} v {kv.Value}");
            //}
        }

I am intertested in UI part. However it may take some time for me. So I think I'd better submit the none-ui part first.

There are some thoughts I commented in code. It may look messy. I will delete those after I put them in issues next time.

in0finite commented 5 years ago

I think you didn't understand one thing about windows. You should add window scripts to UI prefab, not in Startup scene. Just open UI.prefab and see where StartGameWindow is attached.

lexnewgate commented 5 years ago

OK. I will have a look at it.

lexnewgate commented 5 years ago

Working on UI Part now. Since I have never used IMGUI, it will take some time.

lexnewgate commented 5 years ago

image

This is a screenshot of GXT window for the moment.

First, click any button in tablename col. Then a col of crc shows. Then click any item in crc. The corresponding text will be shown in the rightmost col.

lexnewgate commented 5 years ago

There are some performance issues still. When click the MAIN button, the program will freeze a little bit . Because the MAIN button contains lots of items. I will work it tomorrow. I know how to handle this issue in UGUI(by using object pool and only show items when they are in viewport), but have no idea how to handle them in IMGUI.

in0finite commented 5 years ago

Looks good.

To solve performance issues, use pages. Divide content into pages, and let user select current page. See how it's done in peds window.

lexnewgate commented 5 years ago

The page solution solves the performance problem. image Currently it looks like this. However, when main button clicked. image What do you suggest? Should I make a scroll view of these numbers? Or add two more buttons such as << >>. (When clicked, add all indices to a certain number?)

in0finite commented 5 years ago

Mhm, I understand. I think you should limit number of pages to some number, eg 6. And display buttons << and >>, like you said.

lexnewgate commented 5 years ago

I have make the following function a little messy.

public static int DrawPagedViewNumbers (Rect rect, int currentPage, int numPages)

I don't know whether should I refactor it by some design patterns? Or just leave it be. Since it may make the function more complex.

in0finite commented 5 years ago

It seems complicated. Leave paging to me. Can you revert changes to GUIUtils ?

And that should be all regarding gxt for now.

Also, revert changes to Startup scene.

in0finite commented 5 years ago

Actually, if it works fine with both peds and gxt window, then don't revert GUIUtils.

lexnewgate commented 5 years ago

yeah. It works well with both peds and gxt window. So I will only revert startup scene. I am not familiar git yet. I will search how to do it.

lexnewgate commented 5 years ago

I have reverted the changes to startup scene.