Example #1
0
    public void MapOnGUI(TilesetAON tilesetAON, AutoTileMapSerializeData d, AutoTileMap autoTileMap, AComponent_Button.OnClick closeDialog)
    {
        float W_ScopeList  = 200;
        float yGui         = 0f;
        Rect  rectMenuLeft = new Rect(0, 0, W_ScopeList, Screen.height);

        AONGUI.Box(rectMenuLeft, "", tilesetAON.ListStyleBlack);
        {
            Rect rect = new Rect(0, 0, W_ScopeList, Screen.height);
            yGui = 4f;
            AONGUI.Box(rect, "", tilesetAON.ListStyleBlack);
            AONGUI.Button(new Rect(4, yGui, 45, 26), "Back", closeDialog);
            AONGUI.Label(new Rect(54, yGui, W_ScopeList - 54, 26), "Map edit");
            yGui += 32f;
            OnGUIMenuLeft(tilesetAON, ref yGui, rectMenuLeft);
        }
        Rect rectContent = new Rect(W_ScopeList, 0, Screen.width - W_ScopeList, Screen.height);

        AONGUI.Box(rectContent, "");
        yGui = 0f;

        if (mMenuLeft == EMenuLeft.General)
        {
            OnGuiGeneral(tilesetAON, autoTileMap, rectContent);
        }
        else if (mMenuLeft == EMenuLeft.FlagMap)
        {
            FlagGui.DisOnGUI(d.FlagMap, ref yGui, rectContent, null, tilesetAON.ListStyleBlack2, "Flag map edit :");
        }
        else if (mMenuLeft == EMenuLeft.Action)
        {
            // OnGUITriggerList(tilesetAON, d, eSlotAonTypeObj.Warps, DefineAON.IdSlot_Warps, ref yGui, rectContent);
            if (d.ListFlagAction == null)
            {
                d.ListFlagAction = new List <FlagAction>();
            }
            if (d.ListFlagAction.Count == 0)
            {
                d.ListFlagAction.Add(new FlagAction());
            }
            d.ListFlagAction[0].Name  = "";
            d.ListFlagAction[0].Key   = "";
            d.ListFlagAction[0].Value = 0;
            Rect rect     = new Rect(W_ScopeList, 0, Screen.width - W_ScopeList, Screen.height);
            bool isWaitUI = false;
            if (FlagAction.OnGUIFlagActionList(ref yGui, ref isWaitUI, rectContent, d.ListFlagAction, d.FlagMap, tilesetAON.ListStyleBlack2))
            {
                return;
            }
        }
        else if (mMenuLeft == EMenuLeft.Warp)
        {
            OnGUITriggerList(tilesetAON, d, eSlotAonTypeObj.Warps, DefineAON.IdSlot_Warps, ref yGui, rectContent);
        }
        else if (mMenuLeft == EMenuLeft.NPC)
        {
            OnGUITriggerList(tilesetAON, d, eSlotAonTypeObj.Person, DefineAON.IdSlot_NPC, ref yGui, rectContent);
        }
        else if (mMenuLeft == EMenuLeft.Script)
        {
            OnGUITriggerList(tilesetAON, d, eSlotAonTypeObj.Script, DefineAON.IdSlot_Script, ref yGui, rectContent);
        }
        // float yGui = 0f;
        // bool isUpdateFlag = FlagGui.DisOnGUI( ref d.FlagMap, ref yGui, rect, null, tilesetAON.ListStyleBlack2, "Flag map edit :");
    }
Example #2
0
    public void WorldOnGUI(TilesetAON tilesetAON, AutoTileMapData d, AComponent_Button.OnClick onCloseDialog)
    {
        // Rect rect
        Rect rectFull = new Rect(0, 0, Screen.width, Screen.height);

        AONGUI.Box(rectFull, "");
        float W_ScopeList = 200;

        {
            Rect  rect = new Rect(0, 0, W_ScopeList, Screen.height);
            float yGui = 4f;
            AONGUI.Box(rect, "", tilesetAON.ListStyleBlack);
            AONGUI.Button(new Rect(4, yGui, 45, 26), "Back", onCloseDialog);
            AONGUI.Label(new Rect(54, yGui, W_ScopeList - 54, 26), "World edit");
            yGui += 32f;
            float w = (W_ScopeList) / 2;
            AONGUI.Button(new Rect(4, yGui, w - 8, 26), "Save", () => {
                string title = "Save world data ( not include map)";
                FileBrowser.SaveFilePanel(title, title, Application.persistentDataPath, "worlddata.json", new string[] { "json" }, null, (bool canceled, string filePath) => {
                    if (canceled)
                    {
                        return;
                    }
                    File.WriteAllText(filePath, d.GetDataWorld(false));
                });
            });
            AONGUI.Button(new Rect(w + 4, yGui, w - 8, 26), "Load", () => {
                var title = "Load world data ( not include map)";
                var path  = Application.persistentDataPath + "/worlddata.json";
                FileBrowser.OpenFilePanel(title, path, new string[] { "json" }, null, (bool canceled, string filePath) => {
                    if (canceled)
                    {
                        return;
                    }
                    if (File.Exists(filePath))
                    {
                        var data = File.ReadAllText(filePath);
                        if (d.LoadDataWorld(data, false) == false)
                        {
                            InputFieldHelper.Instance.ShowNoti("Load error");
                        }
                    }
                });
            });
            yGui += 4f;
            yGui += 32f;
            OnGUIMenuLeft(tilesetAON, ref yGui, new Rect(0, 0, W_ScopeList, rectFull.height));
        }
        if (mMenuLeft == EMenuLeft.FlagWorld)
        {
            Rect  rect = new Rect(W_ScopeList, 0, Screen.width - W_ScopeList, Screen.height);
            float yGui = 0f;
            FlagGui.DisOnGUI(d.FlagWorld, ref yGui, rect, AutoTileMapData.LockFlagWorld, tilesetAON.ListStyleBlack2, "Flag world edit :");
        }
        else if (mMenuLeft == EMenuLeft.ActionWorld)
        {
            if (d.ListFlagAction == null)
            {
                d.ListFlagAction = new List <FlagAction>();
            }
            if (d.ListFlagAction.Count == 0)
            {
                d.ListFlagAction.Add(new FlagAction());
            }
            d.ListFlagAction[0].Name  = "";
            d.ListFlagAction[0].Key   = "";
            d.ListFlagAction[0].Value = 0;
            Rect  rect     = new Rect(W_ScopeList, 0, Screen.width - W_ScopeList, Screen.height);
            float yGui     = 0f;
            bool  isWaitUI = false;
            if (FlagAction.OnGUIFlagActionList(ref yGui, ref isWaitUI, rect, d.ListFlagAction, d.FlagWorld, tilesetAON.ListStyleBlack2))
            {
                return;
            }
        }
        else if (mMenuLeft == EMenuLeft.Property)
        {
            Rect rect = new Rect(W_ScopeList, 0, Screen.width - W_ScopeList, Screen.height);
            PropertysGUI.Instance.OnGUI(d.Propertys, d.ListFlagAction, tilesetAON, rect);
        }
        else if (mMenuLeft == EMenuLeft.Package)
        {
            Rect rect = new Rect(W_ScopeList, 0, Screen.width - W_ScopeList, Screen.height);
            PackagesGUI.Instance.OnGUI(d.Packages, d.Propertys, d.ListFlagAction, tilesetAON, rect);
        }
    }