Esempio n. 1
0
 public void UpdateTexturePrew()
 {
     if (texturePrew && editorCreated)
     {
         UpdateLayer(-1);
         if (curSpriteMode)
         {
             if (spriteId != -1)
             {
                 texturePrew.sprite = XCPManager.PngToSprite(XCPManager.currentXCP.spriteTextures[spriteId]);
             }
         }
         else
         {
             if (curTileId != -1)
             {
                 if (XCPManager.currentXCP.tileTextures != null)
                 {
                     texturePrew.sprite = XCPManager.PngToSprite(XCPManager.currentXCP.tileTextures[curTile]);
                 }
             }
         }
     }
     GlobalToolManager.SendToolUpdate();
 }
Esempio n. 2
0
 public void UpdateLayer(int targetLayer)
 {
     if (spriteMode)
     {
         curSortingLayer = targetLayer;
         if (curSortingLayer > 4)
         {
             curSortingLayer = 4;
         }
         if (curSortingLayer <= -1)
         {
             curSortingLayer = 0;
         }
         tileInfo.text = "Sorting Layer : " + curSortingLayer;
     }
     else
     {
         if (tileInfo != null)
         {
             if (targetLayer != -1)
             {
                 curLayer = targetLayer;
             }
             tileInfo.text = "Layer : " + curLayer;
         }
     }
     GlobalToolManager.SendToolUpdate();
 }
Esempio n. 3
0
        // Tries to open and load a map file on users computer

        /*
         *      public static void MapDataOpenMap(string mapName = "", string mapPath = "")
         *      {
         *              switch (MapDataPrepForChange())
         *              {
         *                      case -1:
         *                      break;
         *                      case 0:
         *                              MapDataSaveMap();
         *                              MapDataQuery.DeleteMapQuery();
         *                      goto case 1;
         *                      case 1:
         *                              GlobalToolManager.disabelTools();
         *                              MapDataQuery.DeleteMapQuery();
         *                              SessionManager.SessionManagerClearRefs();
         *
         *                              mapData = MapDataImportFromFile(mapPath, mapName + ".berrymap");
         *
         *                              mapDataFileName = mapName;
         *                              mapDataTileSize = 0.32f;
         *                              UiManager.DestroyAllFocus();
         *
         *                              if(mapData == null){ Debug.LogError("WOOOPSI"); }
         *                              MapDataCreateMapObj();
         *
         *                      break;
         *              }
         *      }
         */

        public static void MapDataOpenXCPMap(int mapIndex)
        {
            if (XCPManager.currentXCP.xpcMaps[mapIndex] == null)
            {
                Debug.LogError("WWWWWNWOWPWEWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW");
            }
            //if(mapIndex == mapDataXCPIndex) {UiManager.DestroyAllFocus(); Debug.Log("Sorry Dave but i can't let you do that."); return;}

            GlobalToolManager.DisabelTools();
            MapDataQuery.DeleteMapQuery();
            SessionManager.SessionManagerClearRefs();

            mapDataXCPIndex = mapIndex;

            mapDataFileName = XCPManager.currentXCP.xpcMaps[mapIndex].map;
            mapDataTileSize = 0.32f;
            ScenePrimer.curPrimerComponent.PrimerMapUpdate();
            UiManager.DestroyAllFocus();

            if (XCPManager.currentXCP.xpcMaps[mapDataXCPIndex] == null)
            {
                Debug.LogError("WOOOPSI");
            }
            MapDataCreateMapObj();
        }
Esempio n. 4
0
        // Creates a empty map that is only stored in temp memory.
        public static void MapDataCreateEmptyMap(string mapName = "New Map")
        {
            GlobalToolManager.DisabelTools();
            MapDataQuery.DeleteMapQuery();
            SessionManager.SessionManagerClearRefs();

            if (XCPManager.currentXCP.xpcMaps == null)
            {
                XCPManager.currentXCP.xpcMaps    = new MapData[1];
                XCPManager.currentXCP.xpcMaps[0] = new MapData().CreateEmptyMapData(mapName, EditorPrimer.editorVersionNumberInternal, "Derelictus");
                mapDataXCPIndex = 0;
            }
            else
            {
                Array.Resize(ref XCPManager.currentXCP.xpcMaps, XCPManager.currentXCP.xpcMaps.Length + 1);
                XCPManager.currentXCP.xpcMaps[XCPManager.currentXCP.xpcMaps.Length - 1] = new MapData().CreateEmptyMapData(mapName, EditorPrimer.editorVersionNumberInternal, "Derelictus");;
                mapDataXCPIndex = XCPManager.currentXCP.xpcMaps.Length - 1;
            }
            mapDataFileName = mapName;
            mapDataTileSize = 0.32f;
            SessionManager.CreateMapLayer("Layer 0", true, true);
            ScenePrimer.curPrimerComponent.PrimerMapUpdate();
            UiManager.DestroyAllFocus();
            MapDataCreateMapObj();
        }
Esempio n. 5
0
 public override void PrimerInitialize()
 {
     primerModeName = "Game";
     GlobalToolManager.DisabelTools();
     gameUI = UiManager.CreateCanvas("gameUI", primerParrentObj);
     CreatePlayer();
     GL.Clear(true, true, new Color(0, 0, 0, 0));
 }
Esempio n. 6
0
        public override void PrimerInitialize()
        {
            primerModeName = "Console";
            GlobalToolManager.DisabelTools();
            UiManager.CreateEventSystem(this.gameObject);
            ConsoleManager.CreateConsole();

            GL.Clear(true, true, new Color(0, 0, 0, 0));
        }
Esempio n. 7
0
 public void ItemHandler(string path, bool selectedMode, ItemPress handler, bool headLess, int index)
 {
     if (headLess)
     {
         GlobalToolManager.globalToolManager.SetTool(new EditorToolTilePen());
         GlobalToolManager.SendToolUpdate();
         ScenePrimer.curEditorPrimer.curSpriteId   = newField.items[index].index;
         ScenePrimer.curEditorPrimer.curSpriteMode = true;
         ScenePrimer.curEditorPrimer.UpdateLayer(3);
         WindowTerminate();
         return;
     }
     if (selectedItem != handler)
     {
         if (selectedItem != null)
         {
             selectedItem.selected = false;
             selectedItem.curLocAC.selectIntractable(false);
             selectedItem          = handler;
             selectedItem.selected = true;
             selectedItem.curLocAC.selectIntractable(true);
             GlobalToolManager.globalToolManager.SetTool(new EditorToolTilePen());
             GlobalToolManager.SendToolUpdate();
             ScenePrimer.curEditorPrimer.curSpriteId   = selectedItem.itemTarget.index;
             ScenePrimer.curEditorPrimer.curSpriteMode = true;
             ScenePrimer.curEditorPrimer.UpdateLayer(3);
             WindowTerminate();
         }
         else
         {
             selectedItem          = handler;
             selectedItem.selected = true;
             selectedItem.curLocAC.selectIntractable(true);
             GlobalToolManager.globalToolManager.SetTool(new EditorToolTilePen());
             GlobalToolManager.SendToolUpdate();
             ScenePrimer.curEditorPrimer.curSpriteId   = selectedItem.itemTarget.index;
             ScenePrimer.curEditorPrimer.curSpriteMode = true;
             ScenePrimer.curEditorPrimer.UpdateLayer(3);
             WindowTerminate();
         }
     }
     else
     {
         selectedItem.selected = true;
         selectedItem.curLocAC.selectIntractable(true);
         ScenePrimer.curEditorPrimer.curSpriteId = selectedItem.itemTarget.index;
         ScenePrimer.curEditorPrimer.UpdateLayer(3);
         GlobalToolManager.SendToolUpdate();
     }
 }
Esempio n. 8
0
 public static void DestroyAllFocus()
 {
     // Enable scrolling.
     if (ScenePrimer.curPrimerComponent.curZoomComp != null)
     {
         ScenePrimer.curPrimerComponent.curZoomComp.zoomingEnabled = true;
     }
     // Re-enable input.
     ScenePrimer.curPrimerComponent.disableInput = true;
     GlobalToolManager.DisableInput(true);
     if (focusSeparates != null)
     {
         for (int i = 0; i < focusSeparates.Length; i++)
         {
             GameObject.Destroy(focusSeparates[i]);
         }
         focusSeparates = null;
     }
     GameObject.Destroy(curFocusObj);
     GameObject.Destroy(focusInstanceObj);
 }
Esempio n. 9
0
        public override void PrimerInitialize()
        {
            primerModeName = "Editor Mode";
            worldMaterial  = ScenePrimer.StandardWorld;
            spriteMaterial = ScenePrimer.StandardSprite;
            // Create a empty map
            SessionManager.SessionManagerClearRefs();
            editorIcons = Resources.LoadAll <Sprite>("BerrySystem/Icons/editorIcons");

            if (XCPManager.currentXCP == null)
            {
                takesInput = false;
                BXCPManager xcpWin = new BXCPManager();
                xcpWin.windowTitleName = "editorXCPWindow";
                WindowManager.CreateWindow(200, 300, xcpWin, false, true);
                disableInput = true;


                /*
                 * // Display logo.
                 * UiBackgroundObject logo = new UiBackgroundObject();
                 * logo.uiObjName = "Xonomoto logo";
                 * logo.uiTextureRef = Resources.Load<Sprite>("Xonomoto_studios");
                 * logo.uiAnchorMode = UiManager.UiAnchorsMode.TopRight;
                 * UiManager.CreateBackgroundObj(null, logo);
                 */


                return;
            }
            else
            {
            }

            /*
             *          if(MapDataManager.mapDataXCPIndex == -1){
             *                  MapDataManager.mapData = new MapData().createEmptyMapData("New Map", EditorPrimer.editorVersionNumberInternal,"Derelictus");
             *                  MapDataManager.mapDataFileName = "New Map";
             *                  MapDataManager.mapDataTileSize = 0.32f;
             *                  SessionManager.CreateMapLayer("Layer 0", true, true);
             *                  MapDataManager.MapDataCreateMapObj();
             *          }
             */


            // Create the editor camera.
            // = MapDataConverter.Vector3ToV3( new Vector3(0, 5.8f, 12.75f) );
            // = MapDataConverter.Color32ToV3( new Color32(109, 166, 255, 255) );
            if (primerCurCameraObj == null)
            {
                PrimerCreateCamera();
            }
            disableInput = false;

            editorUi = UiManager.CreateCanvas("editorUi", primerParrentObj);

            SpawnIcon                = new GameObject("editorSetterIcon");
            SpawnIconRenderer        = SpawnIcon.AddComponent <SpriteRenderer>();
            SpawnIconRenderer.sprite = Resources.Load <Sprite>("BerrySystem/Textures/Topdown/alphaSpawn1");
            SpawnIconRenderer.transform.eulerAngles = new Vector2(90, 0);
            SpawnIconRenderer.transform.position    = MapDataConverter.V3ToVector3(XCPManager.currentXCP.xpcMaps[MapDataManager.mapDataXCPIndex].mapLayers[MapDataManager.mapDataCurrentLayer].layerSpawn);
            SpawnIconRenderer.transform.position   += new Vector3(0, 0.3f, 0);
            SpawnIconRenderer.sortingOrder          = SessionManager.SpriteSortByPos(SpawnIconRenderer);

            spriteIcon         = new GameObject("editorSpritePrew");
            spriteIconRenderer = spriteIcon.AddComponent <SpriteRenderer>();
            spriteIconRenderer.transform.eulerAngles = new Vector2(90, 0);
            spriteIconRenderer.transform.position   += new Vector3(0, 0.4f, 0);
            spriteIconRenderer.material = spriteMaterial;
            spriteIcon.AddComponent <MoveAlong>().Icon = spriteIconRenderer;
            spriteIcon.SetActive(false);


            /*
             */
            editorGridObj = new GameObject("editorGrid");
            editorGridObj.transform.SetParent(primerParrentObj.transform);
            editorGridObj.AddComponent <CameraGrid2D>();

            worldGrid2D = new GameObject("World2DGrid");
            worldGrid2D.transform.SetParent(primerParrentObj.transform);
            worldGrid2D.AddComponent <WorldGrid2D>();
            editorUiStatic = UiManager.CreateCanvas("EditorStatic", editorUi, false, true, 0, false);
            UiManager.SetUiAnchors(editorUiStatic, UiManager.UiAnchorsMode.FillStretch);

            // Editor side bar
            UiBackgroundObject editorSideBar = new UiBackgroundObject();

            editorSideBar.uiObjName    = "editorSideBar";
            editorSideBar.uiPosition   = new Vector2(16, 0);
            editorSideBar.uiSize       = new Vector2(32, 0);
            editorSideBar.uiColor      = new Color32(0, 115, 180, 255);
            editorSideBar.uiAnchorMode = UiManager.UiAnchorsMode.MiddelLeftStretchVertical;
            UiManager.CreateBackgroundObj(editorUiStatic, editorSideBar);

            // Editor side bar
            UiBackgroundObject editorTextureWindow = new UiBackgroundObject();

            editorTextureWindow.uiObjName    = "editorTexture";
            editorTextureWindow.uiPosition   = new Vector2(74, 40);
            editorTextureWindow.uiSize       = new Vector2(70, 70);
            editorTextureWindow.uiRayCast    = true;
            editorTextureWindow.uiColor      = new Color32(255, 255, 255, 250);
            editorTextureWindow.uiAnchorMode = UiManager.UiAnchorsMode.BottomLeft;
            texturePrew = UiManager.CreateBackgroundObj(editorUiStatic, editorTextureWindow).GetComponent <Image>();
            texturePrew.preserveAspect = true;
            if (ScenePrimer.curEditorPrimer.curTileId == -1)
            {
                ScenePrimer.curEditorPrimer.curTileId = 0;
            }

            // Editor Window Title Bar
            UiBackgroundObject editorWindowTitleBar = new UiBackgroundObject();

            editorWindowTitleBar.uiObjName    = "editorWindowTitleBar";
            editorWindowTitleBar.uiPosition   = new Vector2(0, -16);
            editorWindowTitleBar.uiSize       = new Vector2(0, 32);
            editorWindowTitleBar.uiColor      = new Color32(40, 170, 224, 255);
            editorWindowTitleBar.uiAnchorMode = UiManager.UiAnchorsMode.TopStretchHorizontal;
            UiManager.CreateBackgroundObj(editorUiStatic, editorWindowTitleBar);

            // Editor Tool Bar
            UiBackgroundObject editorToolBar = new UiBackgroundObject();

            editorToolBar.uiObjName    = "editorToolBar";
            editorToolBar.uiPosition   = new Vector2(0, -48);
            editorToolBar.uiSize       = new Vector2(0, 32);
            editorToolBar.uiColor      = new Color(0, 0.552f, 0.807f, 1f);
            editorToolBar.uiAnchorMode = UiManager.UiAnchorsMode.TopStretchHorizontal;
            UiManager.CreateBackgroundObj(editorUiStatic, editorToolBar);

            editorInteractive = UiManager.CreateCanvas("EditorInteractive", editorUi, false, true, 0, true);
            UiManager.SetUiAnchors(editorInteractive, UiManager.UiAnchorsMode.FillStretch);

            UiTextObject editorTileLayerInfo = new UiTextObject();

            editorTileLayerInfo.uiObjName    = "editorTileLayerInfo";
            editorTileLayerInfo.uiAnchorMode = UiManager.UiAnchorsMode.BottomLeft;
            editorTileLayerInfo.uiTextColor  = new Color(1, 1, 1, 1);
            editorTileLayerInfo.uiText       = "Layer : " + curLayer;
            editorTileLayerInfo.uiTextAlign  = TextAnchor.MiddleCenter;
            editorTileLayerInfo.uiPosition   = new Vector2(74, 90);
            editorTileLayerInfo.uiSize       = new Vector2(70, 70);
            tileInfo = UiManager.CreateTextObj(editorInteractive, editorTileLayerInfo).GetComponent <Text>();

            UiButtonObject editorGridButton = new UiButtonObject();

            editorGridButton.uiObjName                          = "editorGridButton";
            editorGridButton.uiPosition                         = new Vector2(-16, -48);
            editorGridButton.uiSize                             = new Vector2(32, 33);
            editorGridButton.uiButtonIcon.uiSize                = new Vector2(32, 32);
            editorGridButton.uiButtonIcon.uiTextureRef          = editorIcons[5];
            editorGridButton.uiAnchorMode                       = UiManager.UiAnchorsMode.TopRight;
            editorGridButton.uiButtonBackgroundObject.uiRayCast = true;
            editorGridButton.uiButtonBackgroundObject.uiSize    = new Vector2(32, 32);
            editorGridButton.uiButtonBackgroundObject.uiColor   = new Color32(255, 255, 255, 0);

            UiManager.CreateButton(editorInteractive, editorGridButton).gameObject.AddComponent <EditorGridBtn>();

            UiTextObject mapTitle = new UiTextObject();

            mapTitle.uiObjName    = "editorTitle";
            mapTitle.uiTextAlign  = TextAnchor.MiddleCenter;
            mapTitle.uiAnchorMode = UiManager.UiAnchorsMode.TopStretchHorizontal;
            mapTitle.uiSize       = new Vector2(32, 32);
            mapTitle.uiPosition   = new Vector2(0, -16);
            mapTitle.uiText       = MapDataManager.mapDataFileName;
            editorMapTitle        = UiManager.CreateTextObj(editorInteractive, mapTitle);

            // Editor File Menu
            UiButtonObject editorFileMenu = new UiButtonObject();

            editorFileMenu.uiObjName    = "editorFileMenu";
            editorFileMenu.uiAnchorMode = UiManager.UiAnchorsMode.TopLeft;
            editorFileMenu.uiPosition   = new Vector2(25, -48);
            editorFileMenu.uiSize       = new Vector2(50, 32);
            editorFileMenu.uiStaticObj  = true;
            editorFileMenu.uiButtonBackgroundObject.uiColor = new Color32(255, 255, 255, 0);

            editorFileMenu.uiButtonText             = new UiTextObject();
            editorFileMenu.uiButtonText.uiTextAlign = TextAnchor.MiddleCenter;
            editorFileMenu.uiButtonText.uiText      = "File";

            editorFileMenu.uiButtonIcon = null;

            editorFileMenu.uiButtonBackgroundObject.uiRayCast    = true;
            editorFileMenu.uiButtonBackgroundObject.uiSize       = new Vector2(50, 32);
            editorFileMenu.uiButtonBackgroundObject.normalColor  = new Color32(255, 255, 255, 0);
            editorFileMenu.uiButtonBackgroundObject.hoverColor   = new Color32(255, 255, 255, 40);
            editorFileMenu.uiButtonBackgroundObject.pressedColor = new Color32(255, 255, 255, 70);
            UiManager.CreateButton(editorInteractive, editorFileMenu).onMouseClickEvent = ClickFileBtn;

            // Editor Editor Menu
            UiButtonObject editorEditorMenu = new UiButtonObject();

            editorEditorMenu.uiObjName    = "editorEditorMenu";
            editorEditorMenu.uiAnchorMode = UiManager.UiAnchorsMode.TopLeft;
            editorEditorMenu.uiPosition   = new Vector2(80, -48);
            editorEditorMenu.uiSize       = new Vector2(60, 32);
            editorEditorMenu.uiStaticObj  = true;
            editorEditorMenu.uiButtonBackgroundObject.uiColor = new Color32(255, 255, 255, 0);

            editorEditorMenu.uiButtonText             = new UiTextObject();
            editorEditorMenu.uiButtonText.uiTextAlign = TextAnchor.MiddleCenter;
            editorEditorMenu.uiButtonText.uiText      = "Editor";

            editorEditorMenu.uiButtonIcon = null;

            editorEditorMenu.uiButtonBackgroundObject.uiRayCast    = true;
            editorEditorMenu.uiButtonBackgroundObject.uiSize       = new Vector2(60, 32);
            editorEditorMenu.uiButtonBackgroundObject.normalColor  = new Color32(255, 255, 255, 0);
            editorEditorMenu.uiButtonBackgroundObject.hoverColor   = new Color32(255, 255, 255, 40);
            editorEditorMenu.uiButtonBackgroundObject.pressedColor = new Color32(255, 255, 255, 70);
            UiManager.CreateButton(editorInteractive, editorEditorMenu).onMouseClickEvent = ClickEditBtn;

            // Editor Editor Menu
            UiButtonObject editorLevelMode = new UiButtonObject();

            editorLevelMode.uiObjName    = "editorLevelMode";
            editorLevelMode.uiAnchorMode = UiManager.UiAnchorsMode.TopCenter;
            editorLevelMode.uiPosition   = new Vector2(-30, -48);
            editorLevelMode.uiSize       = new Vector2(60, 32);
            editorLevelMode.uiStaticObj  = true;
            editorLevelMode.uiButtonBackgroundObject.uiColor = new Color32(255, 255, 255, 0);

            editorLevelMode.uiButtonText             = new UiTextObject();
            editorLevelMode.uiButtonText.uiTextAlign = TextAnchor.MiddleCenter;
            editorLevelMode.uiButtonText.uiText      = "Level";

            editorLevelMode.uiButtonIcon = null;

            editorLevelMode.uiButtonBackgroundObject.uiRayCast    = true;
            editorLevelMode.uiButtonBackgroundObject.uiSize       = new Vector2(60, 32);
            editorLevelMode.uiButtonBackgroundObject.normalColor  = new Color32(255, 255, 255, 30);
            editorLevelMode.uiButtonBackgroundObject.hoverColor   = new Color32(255, 255, 255, 40);
            editorLevelMode.uiButtonBackgroundObject.pressedColor = new Color32(255, 255, 255, 70);
            UiManager.CreateButton(editorInteractive, editorLevelMode);

            // Editor Editor Menu
            UiButtonObject editorUiMode = new UiButtonObject();

            editorUiMode.uiObjName    = "editorUiMode";
            editorUiMode.uiAnchorMode = UiManager.UiAnchorsMode.TopCenter;
            editorUiMode.uiPosition   = new Vector2(30, -48);
            editorUiMode.uiSize       = new Vector2(60, 32);
            editorUiMode.uiStaticObj  = true;
            editorUiMode.uiButtonBackgroundObject.uiColor = new Color32(255, 255, 255, 0);

            editorUiMode.uiButtonText             = new UiTextObject();
            editorUiMode.uiButtonText.uiTextAlign = TextAnchor.MiddleCenter;
            editorUiMode.uiButtonText.uiText      = "Ui";

            editorUiMode.uiButtonIcon = null;

            editorUiMode.uiButtonBackgroundObject.uiRayCast    = true;
            editorUiMode.uiButtonBackgroundObject.uiSize       = new Vector2(60, 32);
            editorUiMode.uiButtonBackgroundObject.normalColor  = new Color32(255, 255, 255, 0);
            editorUiMode.uiButtonBackgroundObject.hoverColor   = new Color32(255, 255, 255, 40);
            editorUiMode.uiButtonBackgroundObject.pressedColor = new Color32(255, 255, 255, 70);
            UiManager.CreateButton(editorInteractive, editorUiMode);

            // Editor Preview Menu
            UiButtonObject preview = new UiButtonObject();

            preview.uiObjName    = "editorPreview";
            preview.uiAnchorMode = UiManager.UiAnchorsMode.TopRight;
            preview.uiPosition   = new Vector2(-64, -48);
            preview.uiSize       = new Vector2(60, 32);
            preview.uiStaticObj  = true;
            preview.uiButtonBackgroundObject.uiColor = new Color32(255, 255, 255, 0);

            preview.uiButtonText             = new UiTextObject();
            preview.uiButtonText.uiTextAlign = TextAnchor.MiddleCenter;
            preview.uiButtonText.uiText      = "Preview";

            preview.uiButtonIcon = null;

            preview.uiButtonBackgroundObject.uiRayCast    = true;
            preview.uiButtonBackgroundObject.uiSize       = new Vector2(60, 32);
            preview.uiButtonBackgroundObject.normalColor  = new Color32(255, 255, 255, 0);
            preview.uiButtonBackgroundObject.hoverColor   = new Color32(255, 255, 255, 40);
            preview.uiButtonBackgroundObject.pressedColor = new Color32(255, 255, 255, 70);
            UiManager.CreateButton(editorInteractive, preview).onMouseClickEvent = ClickPreviewBtn;

            // Create fps and millisecond display.
            UiTextObject editorWindowTitle = new UiTextObject();

            editorWindowTitle.uiObjName    = "editorWindowTitle";
            editorWindowTitle.uiText       = "Construi";
            editorWindowTitle.uiPosition   = new Vector2(40, -15);
            editorWindowTitle.uiSize       = new Vector2(60, 32);
            editorWindowTitle.uiTextColor  = new Color(1, 1, 1, 1f);
            editorWindowTitle.uiTextSize   = 12;
            editorWindowTitle.uiAnchorMode = UiManager.UiAnchorsMode.TopStretchHorizontal;
            UiManager.CreateTextObj(editorUiStatic, editorWindowTitle);

            // Create fps and millisecond display.
            UiTextObject editorFps = new UiTextObject();

            editorFps.uiObjName    = "editorFps";
            editorFps.uiPosition   = new Vector2(120, -15);
            editorFps.uiSize       = new Vector2(90, 32);
            editorFps.uiTextColor  = new Color(1, 1, 1, 1f);
            editorFps.uiTextSize   = 12;
            editorFps.uiAnchorMode = UiManager.UiAnchorsMode.TopStretchHorizontal;
            UiManager.CreateTextObj(editorUiStatic, editorFps).AddComponent <FPSDisplay>();

            // Create pentool.
            UiButtonObject editorLayerSettings = new UiButtonObject();

            editorLayerSettings.uiObjName                          = "editorLayerSettings";
            editorLayerSettings.uiPosition                         = new Vector2(16, -80);
            editorLayerSettings.uiSize                             = new Vector2(32, 32);
            editorLayerSettings.uiButtonIcon.uiSize                = new Vector2(32, 32);
            editorLayerSettings.uiButtonBackgroundObject.uiSize    = new Vector2(32, 32);
            editorLayerSettings.uiButtonBackgroundObject.uiRayCast = true;
            editorLayerSettings.uiAnchorMode                       = UiManager.UiAnchorsMode.TopLeft;
            editorLayerSettings.uiButtonIcon.uiTextureRef          = editorIcons[16];
            UiManager.CreateButton(editorInteractive, editorLayerSettings).onMouseClickEvent = ClickLayerBtn;

            UiButtonObject editorTexturePanel = new UiButtonObject();

            editorTexturePanel.uiObjName                          = "editorTexturePanel";
            editorTexturePanel.uiPosition                         = new Vector2(16, -112);
            editorTexturePanel.uiSize                             = new Vector2(32, 32);
            editorTexturePanel.uiButtonIcon.uiSize                = new Vector2(32, 32);
            editorTexturePanel.uiButtonBackgroundObject.uiSize    = new Vector2(32, 32);
            editorTexturePanel.uiButtonBackgroundObject.uiRayCast = true;
            editorTexturePanel.uiAnchorMode                       = UiManager.UiAnchorsMode.TopLeft;
            editorTexturePanel.uiButtonIcon.uiTextureRef          = editorIcons[7];
            UiManager.CreateButton(editorInteractive, editorTexturePanel).onMouseClickEvent = ClickTexturesBtn;

            UiButtonObject editorSpritePanel = new UiButtonObject();

            editorTexturePanel.uiObjName                          = "editorTexturePanel";
            editorTexturePanel.uiPosition                         = new Vector2(16, -112 - 32);
            editorTexturePanel.uiSize                             = new Vector2(32, 32);
            editorTexturePanel.uiButtonIcon.uiSize                = new Vector2(32, 32);
            editorTexturePanel.uiButtonBackgroundObject.uiSize    = new Vector2(32, 32);
            editorTexturePanel.uiButtonBackgroundObject.uiRayCast = true;
            editorTexturePanel.uiAnchorMode                       = UiManager.UiAnchorsMode.TopLeft;
            editorTexturePanel.uiButtonIcon.uiTextureRef          = editorIcons[28];
            UiManager.CreateButton(editorInteractive, editorTexturePanel).onMouseClickEvent = ClickSpritePanelBtn;

            UiButtonObject editorEntityPanel = new UiButtonObject();

            editorEntityPanel.uiObjName                          = "editorEntityPanel";
            editorEntityPanel.uiPosition                         = new Vector2(16, -112 - 64);
            editorEntityPanel.uiSize                             = new Vector2(32, 32);
            editorEntityPanel.uiButtonIcon.uiSize                = new Vector2(32, 32);
            editorEntityPanel.uiButtonBackgroundObject.uiSize    = new Vector2(32, 32);
            editorEntityPanel.uiButtonBackgroundObject.uiRayCast = true;
            editorEntityPanel.uiAnchorMode                       = UiManager.UiAnchorsMode.TopLeft;
            editorEntityPanel.uiButtonIcon.uiTextureRef          = editorIcons[37];
            UiManager.CreateButton(editorInteractive, editorEntityPanel).onMouseClickEvent = ClickEntityPanelBtn;

            UiButtonObject editorItemPanel = new UiButtonObject();

            editorItemPanel.uiObjName                          = "editorItemPanel";
            editorItemPanel.uiPosition                         = new Vector2(16, -112 - 64 - 32);
            editorItemPanel.uiSize                             = new Vector2(32, 32);
            editorItemPanel.uiButtonIcon.uiSize                = new Vector2(32, 32);
            editorItemPanel.uiButtonBackgroundObject.uiSize    = new Vector2(32, 32);
            editorItemPanel.uiButtonBackgroundObject.uiRayCast = true;
            editorItemPanel.uiAnchorMode                       = UiManager.UiAnchorsMode.TopLeft;
            editorItemPanel.uiButtonIcon.uiTextureRef          = editorIcons[36];
            UiManager.CreateButton(editorInteractive, editorItemPanel).onMouseClickEvent = ClickItemPanelBtn;

            // Create editor tool manager
            curEditorToolManager = GlobalToolManager.CreateGlobalToolManager(primerParrentObj);

            // Create pentool.
            UiButtonObject editorPenTool = new UiButtonObject();

            editorPenTool.uiObjName                          = "editorPenTool";
            editorPenTool.uiPosition                         = new Vector2(16, 32);
            editorPenTool.uiSize                             = new Vector2(32, 32);
            editorPenTool.uiButtonIcon.uiSize                = new Vector2(32, 32);
            editorPenTool.uiButtonBackgroundObject.uiSize    = new Vector2(32, 32);
            editorPenTool.uiButtonBackgroundObject.uiRayCast = true;
            editorPenTool.uiAnchorMode                       = UiManager.UiAnchorsMode.BottomLeft;
            editorPenTool.uiButtonIcon.uiTextureRef          = editorIcons[1];

            curEditorToolManager.EditorTools[0].curToolIndicator                     = UiManager.CreateButton(editorInteractive, editorPenTool).gameObject.AddComponent <EditorToolIndicator>();
            curEditorToolManager.EditorTools[0].curToolIndicator.targetTool          = curEditorToolManager.EditorTools[0];
            curEditorToolManager.EditorTools[0].curToolIndicator.toolActivatedIcon   = editorIcons[12];
            curEditorToolManager.EditorTools[0].curToolIndicator.toolDeActivatedIcon = editorIcons[1];

            UiButtonObject EditorToolEraserPen = new UiButtonObject();

            EditorToolEraserPen.uiObjName                          = "editorToolEraserPen";
            EditorToolEraserPen.uiPosition                         = new Vector2(16, 64);
            EditorToolEraserPen.uiSize                             = new Vector2(32, 32);
            EditorToolEraserPen.uiButtonIcon.uiSize                = new Vector2(32, 32);
            EditorToolEraserPen.uiButtonBackgroundObject.uiSize    = new Vector2(32, 32);
            EditorToolEraserPen.uiButtonBackgroundObject.uiRayCast = true;
            EditorToolEraserPen.uiAnchorMode                       = UiManager.UiAnchorsMode.BottomLeft;
            EditorToolEraserPen.uiButtonIcon.uiTextureRef          = editorIcons[17];

            curEditorToolManager.EditorTools[1].curToolIndicator                     = UiManager.CreateButton(editorInteractive, EditorToolEraserPen).gameObject.AddComponent <EditorToolIndicator>();
            curEditorToolManager.EditorTools[1].curToolIndicator.targetTool          = curEditorToolManager.EditorTools[1];
            curEditorToolManager.EditorTools[1].curToolIndicator.toolActivatedIcon   = editorIcons[18];
            curEditorToolManager.EditorTools[1].curToolIndicator.toolDeActivatedIcon = editorIcons[17];

            UiButtonObject editorFillTool = new UiButtonObject();

            editorFillTool.uiObjName                          = "editorFillTool";
            editorFillTool.uiPosition                         = new Vector2(16, 96);
            editorFillTool.uiSize                             = new Vector2(32, 32);
            editorFillTool.uiButtonIcon.uiSize                = new Vector2(32, 32);
            editorFillTool.uiButtonBackgroundObject.uiSize    = new Vector2(32, 32);
            editorFillTool.uiButtonBackgroundObject.uiRayCast = true;
            editorFillTool.uiAnchorMode                       = UiManager.UiAnchorsMode.BottomLeft;
            editorFillTool.uiButtonIcon.uiTextureRef          = editorIcons[0];

            curEditorToolManager.EditorTools[2].curToolIndicator                     = UiManager.CreateButton(editorInteractive, editorFillTool).gameObject.AddComponent <EditorToolIndicator>();
            curEditorToolManager.EditorTools[2].curToolIndicator.targetTool          = curEditorToolManager.EditorTools[2];
            curEditorToolManager.EditorTools[2].curToolIndicator.toolActivatedIcon   = editorIcons[11];
            curEditorToolManager.EditorTools[2].curToolIndicator.toolDeActivatedIcon = editorIcons[0];

            UiButtonObject editorSelect = new UiButtonObject();

            editorSelect.uiObjName                          = "editorSelect";
            editorSelect.uiPosition                         = new Vector2(16, 128);
            editorSelect.uiSize                             = new Vector2(32, 32);
            editorSelect.uiButtonIcon.uiSize                = new Vector2(32, 32);
            editorSelect.uiButtonBackgroundObject.uiSize    = new Vector2(32, 32);
            editorSelect.uiButtonBackgroundObject.uiRayCast = true;
            editorSelect.uiAnchorMode                       = UiManager.UiAnchorsMode.BottomLeft;
            editorSelect.uiButtonIcon.uiTextureRef          = editorIcons[26];

            curEditorToolManager.EditorTools[3].curToolIndicator                     = UiManager.CreateButton(editorInteractive, editorSelect).gameObject.AddComponent <EditorToolIndicator>();
            curEditorToolManager.EditorTools[3].curToolIndicator.targetTool          = curEditorToolManager.EditorTools[2];
            curEditorToolManager.EditorTools[3].curToolIndicator.toolActivatedIcon   = editorIcons[25];
            curEditorToolManager.EditorTools[3].curToolIndicator.toolDeActivatedIcon = editorIcons[26];

            UiButtonObject editorLineMesh = new UiButtonObject();

            editorLineMesh.uiObjName                          = "editorLineMesh";
            editorLineMesh.uiPosition                         = new Vector2(16, 128 + 32);
            editorLineMesh.uiSize                             = new Vector2(32, 32);
            editorLineMesh.uiButtonIcon.uiSize                = new Vector2(32, 32);
            editorLineMesh.uiButtonBackgroundObject.uiSize    = new Vector2(32, 32);
            editorLineMesh.uiButtonBackgroundObject.uiRayCast = true;
            editorLineMesh.uiAnchorMode                       = UiManager.UiAnchorsMode.BottomLeft;
            editorLineMesh.uiButtonIcon.uiTextureRef          = editorIcons[30];

            curEditorToolManager.EditorTools[5].curToolIndicator                     = UiManager.CreateButton(editorInteractive, editorLineMesh).gameObject.AddComponent <EditorToolIndicator>();
            curEditorToolManager.EditorTools[5].curToolIndicator.targetTool          = curEditorToolManager.EditorTools[5];
            curEditorToolManager.EditorTools[5].curToolIndicator.toolActivatedIcon   = editorIcons[32];
            curEditorToolManager.EditorTools[5].curToolIndicator.toolDeActivatedIcon = editorIcons[30];

            editorCreated = true;
            takesInput    = true;

            UpdateTexturePrew();
        }
Esempio n. 10
0
 public static GameObject CreateUiFocusObj(bool createSeparateFocusInstance = false, bool disabelBackBackground = false, bool fadeInAnimation = false, BerryWindow targetWindow = null, bool killInput = false, bool skipSystemRefrencerce = false)
 {
     if (createSeparateFocusInstance)
     {
         GameObject separateFocus = CreateCanvas("separateFocusCanvas", null, false, true, 10000, true, false);
         if (!disabelBackBackground)
         {
             /*
              *                  ScenePrimer.curPrimerComponent.disableInput = true;
              *                  GlobalToolManager.globalToolManager.disableInput = true;
              */
             GlobalToolManager.DisabelTools();
             UiInteractiveBackgroundObject focusBG = new UiInteractiveBackgroundObject();
             focusBG.uiSize       = new Vector2(0, 0);
             focusBG.normalColor  = new Color(0, 0, 0, 0.35f);
             focusBG.hoverColor   = new Color(0, 0, 0, 0.35f);
             focusBG.pressedColor = new Color(0, 0, 0, 0.35f);
             UiButtonObject focusBackgroundButton = new UiButtonObject();
             focusBackgroundButton.uiSize = new Vector2(0, 0);
             focusBackgroundButton.uiButtonBackgroundObject           = focusBG;
             focusBackgroundButton.uiButtonBackgroundObject.uiRayCast = true;
             focusBackgroundButton.uiButtonBackgroundObject.uiColor   = new Color(0, 0, 0, 0);
             focusBackgroundButton.uiButtonIcon = null;
             focusBackgroundButton.uiButtonBackgroundObject.uiAnchorMode = UiAnchorsMode.FillStretch;
             focusBackgroundButton.uiAnchorMode = UiAnchorsMode.FillStretch;
             GameObject defocusBg = CreateButton(separateFocus, focusBackgroundButton).gameObject;
             defocusBg.AddComponent <DefocusBtn>().focusInstanceObjRef = focusInstanceObj;
             defocusBg.GetComponent <DefocusBtn>().windowReference     = targetWindow;
             defocusBg.GetComponent <DefocusBtn>().killInput           = killInput;
         }
         if (!skipSystemRefrencerce)
         {
             addFocusSeparate(separateFocus);
         }
         return(separateFocus);
     }
     else
     {
         if (curFocusObj != null)
         {
             /*
              *                  if(fadeInAnimation)
              *                  {
              *                          curFocusObj.transform.parent.gameObject.AddComponent<QuickUiAnimator>().PlayFadeAnim(0, 1, false, true, 0.01f);
              *                  }else{
              *                          curFocusObj.SetActive(true);
              *                  }
              */
         }
         else
         {
             GameObject curFocus = CreateCanvas("FocusCanvas", null, false, true, 10000, true, false);
             focusInstanceObj = curFocus;
             if (!disabelBackBackground)
             {
                 /*
                  *                      ScenePrimer.curPrimerComponent.disableInput = true;
                  *                      GlobalToolManager.globalToolManager.disableInput = true;
                  */
                 GlobalToolManager.DisabelTools();
                 UiInteractiveBackgroundObject focusBG = new UiInteractiveBackgroundObject();
                 focusBG.uiSize       = new Vector2(0, 0);
                 focusBG.normalColor  = new Color(0, 0, 0, 0.35f);
                 focusBG.hoverColor   = new Color(0, 0, 0, 0.35f);
                 focusBG.pressedColor = new Color(0, 0, 0, 0.35f);
                 UiButtonObject focusBackgroundButton = new UiButtonObject();
                 focusBackgroundButton.uiSize = new Vector2(0, 0);
                 focusBackgroundButton.uiButtonBackgroundObject           = focusBG;
                 focusBackgroundButton.uiButtonBackgroundObject.uiColor   = new Color(0, 0, 0, 0);
                 focusBackgroundButton.uiButtonBackgroundObject.uiRayCast = true;
                 focusBackgroundButton.uiButtonIcon = null;
                 focusBackgroundButton.uiButtonBackgroundObject.uiAnchorMode = UiAnchorsMode.FillStretch;
                 focusBackgroundButton.uiAnchorMode = UiAnchorsMode.FillStretch;
                 GameObject defocusBg = CreateButton(curFocus, focusBackgroundButton).gameObject;
                 defocusBg.AddComponent <DefocusBtn>().focusInstanceObjRef = focusInstanceObj;
                 defocusBg.GetComponent <DefocusBtn>().windowReference     = targetWindow;
                 defocusBg.GetComponent <DefocusBtn>().killInput           = killInput;
             }
             curFocusObj = curFocus;
             if (fadeInAnimation)
             {
             }
             else
             {
                 curFocusObj.SetActive(true);
             }
             return(curFocus);
         }
         return(focusInstanceObj);
     }
 }
Esempio n. 11
0
 public override void AwakeActionComponent()
 {
     this.GetComponent <UiIntractable>().curAC   = this;
     ScenePrimer.curPrimerComponent.disableInput = true;
     GlobalToolManager.DisableInput(true);
 }