Example #1
0
        public bool WarpOnGUI(Warps warp, Rect rect, AutoTileMap autoTileMap, TilesetAON tilesetAON)
        {
            bool  hasUpdateUI = false;
            float left        = 80f;
            // Input Name
            float yGui = rect.y + 8f;

            AONGUI.Label(new Rect(rect.x, yGui, rect.width, 32f), string.Format("Edit Warp {0}", warp.NameWarps));
            yGui += 32;

            AONGUI.Label(new Rect(rect.x, yGui, left, 32), "Name: ");
            AONGUI.TextField(new Rect(rect.x + left, yGui + 32 - heighTextField, rect.width - left, heighTextField), warp.NameWarps, 25, (string text) => {
                warp.NameWarps = text;
            });
            yGui += 32;
            // Pick Map
            AONGUI.Label(new Rect(rect.x, yGui, left, 32), "Map: ");
            var ComboBoxMap = ComboBoxHelper.Instance.MapList(autoTileMap);

            ComboBoxMap.SelectedItemIndex = warp.map;
            ComboBoxMap.Rect.x            = rect.x + left;
            ComboBoxMap.Rect.y            = yGui;
            ComboBoxMap.Rect.width        = rect.width - left;
            ComboBoxMap.Rect.height       = 32f;
            ComboBoxMap.Show(rect.height - yGui - 32, (int selectedMap) => {
                warp.map = selectedMap;
            });
            yGui += 32f;
            if (ComboBoxMap.IsDropDownListVisible)
            {
                return(hasUpdateUI);
            }
            if (warp.map != -1)
            {
                AONGUI.Label(new Rect(rect.x + 4f, yGui + 4f, rect.width - 8f, 32 - 8f), "x: " + warp.x);
                yGui += 16f;
                AONGUI.Label(new Rect(rect.x + 4f, yGui + 4f, rect.width - 8f, 32 - 8f), "y: " + warp.y);
                yGui += 32f;
                AONGUI.Button(new Rect(rect.x, yGui, rect.width, 32), "Select position on map...", () => {
                    tilesetAON.PickPosOnMap(warp.map, warp.x, warp.y, (PickMapAON p, int _x, int _y) => {
                        warp.x = _x;
                        warp.y = _y;
                    });
                });
            }
            return(hasUpdateUI);
        }
Example #2
0
    private void OnGuiGeneral(TilesetAON tilesetAON, AutoTileMap autoTileMap, Rect rect)
    {
        float yBeginGui = rect.y + 4f;

        AONGUI.Label(new Rect(rect.x + 10f, yBeginGui, 200, DefineAON.GUI_Height_Label), "Map " + autoTileMap.MapIdxSelect);
        // yBeginGui += 32;
        AONGUI.Button(new Rect(rect.x + rect.width - 220, yBeginGui, 200, DefineAON.GUI_Height_Label), "Reset map", () => {
            tilesetAON._isShowDialogClearMap = true;
        });
        yBeginGui += 32;
        AONGUI.Label(new Rect(rect.x + 10f, yBeginGui, rect.width - 8f, DefineAON.GUI_Height_Label), string.Format("Start at: ({0}, {1})", autoTileMap.MapSelect.StartX, autoTileMap.MapSelect.StartY));
        yBeginGui += 32;
        AONGUI.Button(new Rect(rect.x + 10f, yBeginGui, 200, DefineAON.GUI_Height_Button), "Pick start position", () => {
            tilesetAON.PickPosOnMap(autoTileMap.MapIdxSelect, autoTileMap.MapSelect.StartX, autoTileMap.MapSelect.StartY, (PickMapAON p, int _x, int _y) => {
                autoTileMap.MapSelect.StartX = _x;
                autoTileMap.MapSelect.StartY = _y;
            });
        });
    }
Example #3
0
        public bool HouseOnGUI(House house, Rect rect, AutoTileMap autoTileMap, TilesetAON tilesetAON)
        {
            bool  hasUpdateUI = false;
            float left        = 80f;
            // Input Name
            float yGui           = rect.y + 8f;
            float heighTextField = 20f;

            AONGUI.Label(new Rect(rect.x, yGui, rect.width, 32f), string.Format("Edit House {0}", house.NameHouse));
            yGui += 32;

            AONGUI.Label(new Rect(rect.x, yGui, left, 32), "Name: ");
            AONGUI.TextField(new Rect(rect.x + left, yGui + 32 - heighTextField, rect.width - left, heighTextField), house.NameHouse, 25, (string text) => {
                house.NameHouse = text;
            });
            yGui += 32;
            #region Art
            {
                AONGUI.Label(new Rect(rect.x, yGui, left, 32), "House: ");
                var comboBoxHouseList = ComboBoxHelper.Instance.HouseListModel(autoTileMap);
                comboBoxHouseList.SelectedItemIndex = house.IdxArt;
                comboBoxHouseList.Rect.x            = rect.x + left;
                comboBoxHouseList.Rect.y            = yGui;
                comboBoxHouseList.Rect.width        = rect.width - left;
                comboBoxHouseList.Rect.height       = 32f;
                comboBoxHouseList.Show(rect.height - yGui - 32, (int selectedArt) => {
                    house.IdxArt = selectedArt;
                    //
                    int tx = tilesetAON.TileShowMoreInfo.TileX;
                    int ty = tilesetAON.TileShowMoreInfo.TileY;
                    // var slot = autoTileMap.Tileset.GetSlot(tilesetAON.TileShowMoreInfo.Id);
                    autoTileMap.TileChunkPoolNode.GetTileChunk(tx, ty, (int)tilesetAON.TileShowMoreInfo.Layer).RefreshTileOverlay(tx, ty, true);
                });
                yGui += 32f;
                if (comboBoxHouseList.IsDropDownListVisible)
                {
                    return(hasUpdateUI);
                }
            }
            #endregion
            if (house.IdxArt == -1)
            {
                return(hasUpdateUI);
            }
            #region Go In
            if (tilesetAON.TileShowMoreInfo != null)
            {
                int xOffsetIn = 0, yOffsetIn = 0;
                int tx        = tilesetAON.TileShowMoreInfo.TileX;
                int ty        = tilesetAON.TileShowMoreInfo.TileY;
                var rotateRef = autoTileMap.MapSelect.GetRotateRef(tx, ty) % 360;
                house.GetOffsetFromRotate(ref xOffsetIn, ref yOffsetIn, rotateRef);
                AONGUI.Label(new Rect(rect.x + 4f, yGui + 4f, rect.width - 8f, 32 - 8f), string.Format("Go in at: ({0} ,{1})", xOffsetIn, yOffsetIn));
                yGui += 32f;
                AONGUI.Button(new Rect(rect.x, yGui, rect.width, 32), "Pick go in", () => {
                    tilesetAON.PickPosOnMap(autoTileMap.MapIdxSelect, tilesetAON.TileShowMoreInfo.TileX + xOffsetIn, tilesetAON.TileShowMoreInfo.TileY + yOffsetIn, (PickMapAON p, int _x, int _y) => {
                        // house.XOffsetIn = _x - tilesetAON.TileShowMoreInfo.TileX;
                        // house.YOffsetIn = _y - tilesetAON.TileShowMoreInfo.TileY;
                        house.SetOffsetFromRotate(_x - tilesetAON.TileShowMoreInfo.TileX, _y - tilesetAON.TileShowMoreInfo.TileY, rotateRef);
                    });
                });
                yGui += 32f;
            }
            #endregion             //Door
            #region Interior
            {
                AONGUI.Label(new Rect(rect.x, yGui, left, 32), "Interior: ");
                var comboBoxInteriorList = ComboBoxHelper.Instance.InteriorList(autoTileMap);
                comboBoxInteriorList.SelectedItemIndex = house.IdxInterior;
                comboBoxInteriorList.Rect.x            = rect.x + left;
                comboBoxInteriorList.Rect.y            = yGui;
                comboBoxInteriorList.Rect.width        = rect.width - left;
                comboBoxInteriorList.Rect.height       = 32f;
                comboBoxInteriorList.Show(rect.height - yGui - 32, (int selectedInterior) => {
                    house.IdxInterior = selectedInterior;
                });
                yGui += 32f;
                if (comboBoxInteriorList.IsDropDownListVisible)
                {
                    return(hasUpdateUI);
                }
            }
            #endregion
            if (house.IdxInterior == -1)
            {
                return(hasUpdateUI);
            }
            #region Go Out
            // GUI.Label(new Rect(rect.x+ 4f, yGui + 4f, rect.width - 8f, 32 - 8f), string.Format("Go out at: {0}", house.OffsetOut.ToString()));
            // yGui += 32f;
            // GUI.Label(new Rect(rect.x+ 4f, yGui + 4f, rect.width - 8f, 32 - 8f), string.Format("Cam: {0}", house.CamOut.ToString()));
            // yGui += 32f;
            AONGUI.Button(new Rect(rect.x, yGui, rect.width, 32), "Pick go out and camera", () => {
                tilesetAON.PickPosOnInterior(house.IdxInterior, house.OffsetOut, house.CamOut, (TilesetAON t, Vector3 p, Vector3 cam) => {
                    house.OffsetOut = p;
                    house.CamOut    = cam;
                });
            });
            yGui += 32f;
            #endregion             //Door
            // yGui += 16f;
            if (house.NpcInHouses.Count == 0)
            {
                AONGUI.Button(new Rect(rect.x, yGui, rect.width, 32), "Add NPC Inhouse", () => {
                    house.NpcInHouses.Add(new House.NpcInHouse());
                    currentIdNpcTager = 0;
                });
                return(false);
            }
            AONGUI.Label(new Rect(rect.x, yGui, left, 28), "Slot NPC: ");
            var comboBoxCount = ComboBoxHelper.Instance.Number(house.NpcInHouses.Count);
            comboBoxCount.SelectedItemIndex = currentIdNpcTager;
            comboBoxCount.Rect.x            = rect.x + left;
            comboBoxCount.Rect.y            = yGui;
            comboBoxCount.Rect.width        = rect.width - left;
            comboBoxCount.Rect.height       = 32f;
            if (comboBoxCount.IsDropDownListVisible)
            {
                AONGUI.Button(new Rect(rect.x + left, rect.y + rect.height - 64, rect.width - left, 28), "Add Slot", () => {
                    house.NpcInHouses.Add(new House.NpcInHouse());
                    currentIdNpcTager = house.NpcInHouses.Count - 1;
                });
            }
            comboBoxCount.Show(rect.height - yGui - 64, (int next) => {
                currentIdNpcTager = next;
            });
            if (comboBoxCount.IsDropDownListVisible)
            {
                return(hasUpdateUI);
            }
            yGui += 32f;
            if (currentIdNpcTager >= 0 && currentIdNpcTager < house.NpcInHouses.Count)
            {
                if (HouseOnGUIWithNPC(house, house.NpcInHouses[currentIdNpcTager], rect, autoTileMap, tilesetAON, ref yGui))
                {
                    return(hasUpdateUI);
                }
            }
            return(hasUpdateUI);
        }