예제 #1
0
        public override void WindowCreate(int sizeX, int sizeY, GameObject windowRef)
        {
            targetWindowRef = windowRef;
            // A realy bad way to overide.
            sizeX = 520;
            sizeY = 400;

            // Create a window shadow.
            windowShadow.uiObjName    = "Shadow";
            windowShadow.uiTextureRef = Resources.Load <Sprite>("BerrySystem/UI/shadow");
            windowShadow.uiColor      = new Color32(255, 255, 255, 255);
            windowShadow.uiSize       = new Vector2(sizeX + 90, sizeY + 90);
            UiManager.CreateBackgroundObj(windowRef, windowShadow);

            // Create the window panel.
            windowPanel.uiSize    = new Vector2(sizeX, sizeY);
            windowPanel.uiRayCast = true;
            UiManager.CreateBackgroundObj(windowRef, windowPanel).transform.parent.gameObject.AddComponent <QuickUiAnimator>().PlayFadeAnim(0, 1, false, false, 9f);

            UiBackgroundObject xpcInfoPanel = new UiBackgroundObject();

            xpcInfoPanel.uiPosition = new Vector2(-108.07f, -15.12f);
            xpcInfoPanel.uiSize     = new Vector2(284.07f, 340.45f);
            xpcInfoPanel.uiColor    = new Color(0.9f, 0.9f, 0.9f, 1);
            UiManager.CreateBackgroundObj(windowRef, xpcInfoPanel);

            UiTextObject windowTitle = new UiTextObject();

            windowTitle.uiTextColor = new Color(0, 0, 0, 255);
            windowTitle.uiSize      = new Vector2(180, 19);
            windowTitle.uiText      = WindowGrabName();
            windowTitle.uiTextAlign = TextAnchor.UpperCenter;
            windowTitle.uiPosition  = new Vector2(0, 180);
            UiManager.CreateTextObj(windowRef, windowTitle);

            if (creationMode)
            {
                newEntity            = new BEnt();
                newEntity.entName    = "new ent";
                newEntity.entType    = 1;
                newEntity.entHealth  = 100;
                newEntity.entSprites = XCPManager.SpritesToPngs(Resources.LoadAll <Sprite>("BerrySystem/Textures/Topdown/newEnt"));
            }
            else
            {
                if (targetEntID == -1)
                {
                    Debug.LogError("Error! taget ent is -1! Set a valid ID");
                }
            }

            UiTextInputField uiMapName = new UiTextInputField();

            uiMapName.uiPosition = new Vector2(143.7f, 115);
            uiMapName.uiSize     = new Vector2(200, 34);
            uiMapName.uiButtonBackgroundObject.uiRayCast    = true;
            uiMapName.uiButtonBackgroundObject.uiSize       = uiMapName.uiSize;
            uiMapName.uiButtonBackgroundObject.uiColor      = new Color32(100, 100, 100, 100);
            uiMapName.uiButtonBackgroundObject.normalColor  = new Color32(170, 170, 170, 100);
            uiMapName.uiButtonBackgroundObject.hoverColor   = new Color32(134, 166, 255, 100);
            uiMapName.uiButtonBackgroundObject.pressedColor = new Color32(0, 150, 255, 100);
            uiMapName.uiButtonIcon.uiColor  = new Color32(255, 255, 255, 110);
            uiMapName.uiButtonIcon.uiSize   = new Vector2(uiMapName.uiSize.x - 2, uiMapName.uiSize.y - 2);
            uiMapName.fieldName             = new UiTextObject();
            uiMapName.fieldName.uiTextColor = new Color32(0, 0, 0, 255);
            uiMapName.fieldName.uiTextAlign = TextAnchor.UpperLeft;
            uiMapName.fieldName.uiSize      = uiMapName.uiSize;
            uiMapName.fieldName.uiPosition += new Vector2(3, 25);
            uiMapName.fieldName.uiText      = "Entity Name";
            uiMapName.uiButtonText          = new UiTextObject();

            if (creationMode)
            {
                uiMapName.uiButtonText.uiText = newEntity.entName;
            }
            else
            {
                uiMapName.uiButtonText.uiText = XCPManager.currentXCP.entities[targetEntID].entName;
            }

            InputField entProperty = UiManager.CreateTextInputField(windowRef, uiMapName);

            entProperty.onEndEdit.AddListener(delegate { EntitySetName(entProperty.text); });

            if (creationMode)
            {
                uiMapName.uiButtonText.uiText = newEntity.entHealth.ToString();
            }
            else
            {
                uiMapName.uiButtonText.uiText = XCPManager.currentXCP.entities[targetEntID].entHealth.ToString();
            }

            uiMapName.fieldName.uiText = "Entity Health";
            uiMapName.uiPosition       = new Vector2(143.7f, 3.25f);
            entProperty             = UiManager.CreateTextInputField(windowRef, uiMapName);
            entProperty.contentType = InputField.ContentType.DecimalNumber;
            entProperty.onEndEdit.AddListener(delegate { EntitySetName(entProperty.text); });

            UiButtonObject editorFileMenu = new UiButtonObject();

            editorFileMenu.uiObjName    = "editorFileMenu";
            editorFileMenu.uiAnchorMode = UiManager.UiAnchorsMode.TopLeft;
            editorFileMenu.uiPosition   = new Vector2(143.7f, 70f);
            editorFileMenu.uiSize       = new Vector2(200, 34);
            editorFileMenu.uiStaticObj  = true;
            editorFileMenu.uiButtonBackgroundObject.uiColor = new Color32(155, 155, 155, 100);

            editorFileMenu.uiButtonText = null;

            editorFileMenu.uiButtonIcon = new UiBackgroundObject();
            editorFileMenu.uiButtonIcon.uiTextureRef = ScenePrimer.curEditorPrimer.editorIcons[18];
            editorFileMenu.uiButtonIcon.uiColor      = new Color(0, 0, 0, 0.5f);
            editorFileMenu.uiButtonIcon.uiSize       = new Vector2(17, 17);
            editorFileMenu.uiButtonIcon.uiPosition   = new Vector2(85, 0);

            editorFileMenu.uiButtonBackgroundObject.uiRayCast    = true;
            editorFileMenu.uiButtonBackgroundObject.uiSize       = new Vector2(200, 34);
            editorFileMenu.uiButtonBackgroundObject.normalColor  = new Color32(170, 170, 170, 70);
            editorFileMenu.uiButtonBackgroundObject.hoverColor   = new Color32(134, 166, 255, 100);
            editorFileMenu.uiButtonBackgroundObject.pressedColor = new Color32(0, 150, 255, 100);
            UiManager.CreateButton(windowRef, editorFileMenu).gameObject.AddComponent <DropDownButton>().ACClick = ItemSelect;

            if (creationMode)
            {
                windowTitle.uiText = "Set Entity type";
            }
            else
            {
                windowTitle.uiText = newEntity.entType.ToString();
            }
            windowTitle.uiTextAlign = TextAnchor.UpperLeft;
            windowTitle.uiPosition  = new Vector2(139.3f, 67.94f);
            entType = UiManager.CreateTextObj(windowRef, windowTitle).GetComponent <Text>();

            UiButtonObject saveButton = new UiButtonObject();

            saveButton.uiPosition = new Vector2(210, -165);
            saveButton.uiSize     = new Vector2(70, 34);
            saveButton.uiButtonBackgroundObject.uiRayCast = true;
            saveButton.uiButtonBackgroundObject.uiSize    = saveButton.uiSize;

            saveButton.uiButtonBackgroundObject.uiColor      = new Color32(100, 100, 100, 100);
            saveButton.uiButtonBackgroundObject.normalColor  = new Color32(170, 170, 170, 100);
            saveButton.uiButtonBackgroundObject.hoverColor   = new Color32(134, 166, 255, 100);
            saveButton.uiButtonBackgroundObject.pressedColor = new Color32(0, 150, 255, 100);
            saveButton.uiButtonIcon.uiColor     = new Color32(255, 255, 255, 110);
            saveButton.uiButtonIcon.uiSize      = new Vector2(saveButton.uiSize.x - 2, saveButton.uiSize.y - 2);
            saveButton.uiButtonText             = new UiTextObject();
            saveButton.uiButtonText.uiTextColor = new Color32(0, 0, 0, 255);
            saveButton.uiButtonText.uiTextAlign = TextAnchor.MiddleCenter;

            if (creationMode)
            {
                saveButton.uiButtonText.uiText = "Create";
                openBtn = UiManager.CreateButton(windowRef, saveButton).GetComponent <UiIntractable>();
                openBtn.onMouseClickEvent = EntityCreate;
            }
            else
            {
                saveButton.uiButtonText.uiText = "Close";
                openBtn = UiManager.CreateButton(windowRef, saveButton).GetComponent <UiIntractable>();
                openBtn.onMouseClickEvent = WindowTerminate;
            }

            saveButton.uiButtonText.uiText = "Animation editor";
            saveButton.uiSize = new Vector2(120, 34);
            saveButton.uiButtonText.uiSize             = saveButton.uiSize;
            saveButton.uiButtonBackgroundObject.uiSize = saveButton.uiSize;
            saveButton.uiButtonIcon.uiSize             = new Vector2(saveButton.uiSize.x - 2, saveButton.uiSize.y - 2);
            saveButton.uiPosition = new Vector2(-186, -165);
            editBtn = UiManager.CreateButton(windowRef, saveButton).GetComponent <UiIntractable>();
            editBtn.onMouseClickEvent = StartSpriteAnimator;

            saveButton.uiButtonText.uiText = "Texture manager";
            saveButton.uiSize = new Vector2(120, 34);
            saveButton.uiButtonText.uiSize             = saveButton.uiSize;
            saveButton.uiButtonBackgroundObject.uiSize = saveButton.uiSize;
            saveButton.uiButtonIcon.uiSize             = new Vector2(saveButton.uiSize.x - 2, saveButton.uiSize.y - 2);
            saveButton.uiPosition = new Vector2(-30, -165);
            editBtn = UiManager.CreateButton(windowRef, saveButton).GetComponent <UiIntractable>();
            editBtn.onMouseClickEvent = StartTextureManager;

            UiBackgroundObject transparacyBg = new UiBackgroundObject();

            transparacyBg.uiSize     = new Vector2(269, 269);
            transparacyBg.uiPosition = new Vector2(-109f, 12f);
            transparacyBg.uiColor    = new Color32(255, 255, 255, 255);
            spritePrew          = UiManager.CreateBackgroundObj(windowRef, transparacyBg).GetComponent <Image>();
            spritePrew.material = Resources.Load("BerrySystem/Shaders/bgTran", typeof(Material)) as Material;

            UiBackgroundObject sprite = new UiBackgroundObject();

            transparacyBg.uiSize     = new Vector2(260, 260);
            transparacyBg.uiPosition = new Vector2(-109f, 12f);
            if (img == null)
            {
                transparacyBg.uiColor = new Color32(255, 255, 255, 0);
            }
            else
            {
                transparacyBg.uiColor = new Color32(255, 255, 255, 255);
            }
            spritePrew                = UiManager.CreateBackgroundObj(windowRef, transparacyBg).GetComponent <Image>();
            spritePrew.sprite         = img;
            spritePrew.preserveAspect = true;

            //
            windowRef.AddComponent <QuickUiAnimator>().PlayPosAnim(new Vector2(0, 20), new Vector2(0, 0), false, false, 120f);
        }
예제 #2
0
        public override void WindowCreate(int sizeX, int sizeY, GameObject windowRef)
        {
            targetWindowRef = windowRef;
            // A realy bad way to overide.
            sizeX = 200;
            sizeY = Screen.height - 64;

            // Create the window panel.
            windowPanel.uiSize       = new Vector2(sizeX, sizeY);
            windowPanel.uiAnchorMode = UiManager.UiAnchorsMode.MiddelLeftStretchVertical;
            windowPanel.uiPosition   = new Vector2(Screen.width / 2 * -1 + sizeX - 68, -32);
            windowPanel.uiRayCast    = true;
            GameObject panel = UiManager.CreateBackgroundObj(windowRef, windowPanel);

            panel.transform.parent.gameObject.AddComponent <QuickUiAnimator>().PlayFadeAnim(0, 1, false, false, 9f);

            // Window content...
            UiButtonObject editorFileMenu = new UiButtonObject();

            editorFileMenu.uiObjName    = "editorFileMenu";
            editorFileMenu.uiAnchorMode = UiManager.UiAnchorsMode.TopLeft;
            editorFileMenu.uiPosition   = new Vector2(100, -24);
            editorFileMenu.uiSize       = new Vector2(185, 32);
            editorFileMenu.uiStaticObj  = true;
            editorFileMenu.uiButtonBackgroundObject.uiColor = new Color32(155, 155, 155, 100);

            editorFileMenu.uiButtonText             = new UiTextObject();
            editorFileMenu.uiButtonText.uiSize      = new Vector2(185, 32);
            editorFileMenu.uiButtonText.uiTextAlign = TextAnchor.MiddleCenter;
            editorFileMenu.uiButtonText.uiText      = "Import Sprite";
            editorFileMenu.uiButtonText.uiTextColor = new Color(0, 0, 0, 1);

            editorFileMenu.uiButtonIcon = null;

            /*
             * editorFileMenu.uiButtonIcon = new UiBackgroundObject();
             * editorFileMenu.uiButtonIcon.uiTextureRef = ScenePrimer.curEditorPrimer.editorIcons[18];
             * editorFileMenu.uiButtonIcon.uiColor = new Color(0, 0, 0, 0.5f);
             * editorFileMenu.uiButtonIcon.uiSize = new Vector2(17, 17);
             * editorFileMenu.uiButtonIcon.uiPosition = new Vector2(78, 0);
             */

            editorFileMenu.uiButtonBackgroundObject.uiRayCast    = true;
            editorFileMenu.uiButtonBackgroundObject.uiSize       = new Vector2(185, 32);
            editorFileMenu.uiButtonBackgroundObject.normalColor  = new Color32(170, 170, 170, 70);
            editorFileMenu.uiButtonBackgroundObject.hoverColor   = new Color32(134, 166, 255, 100);
            editorFileMenu.uiButtonBackgroundObject.pressedColor = new Color32(0, 150, 255, 100);
            UiManager.CreateButton(panel, editorFileMenu).gameObject.AddComponent <DropDownButton>().ACClick = CreateSpriteImporter;

            UiItemFeild uiFileBrowser = new UiItemFeild();

            uiFileBrowser.uiPosition   = new Vector2(100, -24);
            uiFileBrowser.uiSize       = new Vector2(200, -50);
            uiFileBrowser.uiColor      = new Color32(239, 239, 239, 255);
            uiFileBrowser.uiAnchorMode = UiManager.UiAnchorsMode.MiddelLeftStretchVertical;
            newField = UiManager.CreateItemsFeild(panel, uiFileBrowser);
            newField.useNumberShortCut = true;

            GenerateMapView();

            windowRef.AddComponent <QuickUiAnimator>().PlayPosAnim(new Vector2(-230, 0), new Vector2(0, 0), false, false, 1800f);
        }
예제 #3
0
        public override void WindowCreate(int sizeX, int sizeY, GameObject windowRef)
        {
            targetWindowRef = windowRef;
            // A realy bad way to overide.
            sizeX = 520;
            sizeY = 400;

            // Create a window shadow.
            windowShadow.uiObjName    = "Shadow";
            windowShadow.uiTextureRef = Resources.Load <Sprite>("BerrySystem/UI/shadow");
            windowShadow.uiColor      = new Color32(255, 255, 255, 255);
            windowShadow.uiSize       = new Vector2(sizeX + 90, sizeY + 90);
            UiManager.CreateBackgroundObj(windowRef, windowShadow);

            // Create the window panel.
            windowPanel.uiSize    = new Vector2(sizeX, sizeY);
            windowPanel.uiColor   = new Color32(15, 15, 15, 255);
            windowPanel.uiRayCast = true;
            UiManager.CreateBackgroundObj(windowRef, windowPanel).transform.parent.gameObject.AddComponent <QuickUiAnimator>().PlayFadeAnim(0, 1, false, false, 9f);

            UiBackgroundObject xpcInfoPanel = new UiBackgroundObject();

            xpcInfoPanel.uiPosition = new Vector2(-43.04f, -161.57f);
            xpcInfoPanel.uiSize     = new Vector2(414.14f, 47.56f);
            xpcInfoPanel.uiColor    = new Color32(24, 24, 24, 255);
            UiManager.CreateBackgroundObj(windowRef, xpcInfoPanel);

            UiTextObject windowTitle = new UiTextObject();

            windowTitle.uiTextColor = new Color(1, 1, 1, 1);
            windowTitle.uiText      = WindowGrabName();
            windowTitle.uiSize      = new Vector2(180, 19);
            windowTitle.uiTextAlign = TextAnchor.UpperCenter;
            windowTitle.uiPosition  = new Vector2(0, 180);
            UiManager.CreateTextObj(windowRef, windowTitle);

            windowTitle.uiTextAlign = TextAnchor.MiddleLeft;
            windowTitle.uiText      = "Sprite ID : " + TargetSprite;
            windowTitle.uiPosition  = new Vector2(131, 140);
            UiManager.CreateTextObj(windowRef, windowTitle);

            /*
             * if(TargetSprite == -1)
             * {
             *  windowTitle.uiText = "Pixsel scale : ?";
             * }else{
             *  img = XCPManager.PngToSprite( XCPManager.currentXCP.itemIds[TargetSprite] );
             *  windowTitle.uiText = "Pixsel scale : " + XCPManager.currentXCP.itemIds[TargetSprite].pixScale;
             * }
             */
            windowTitle.uiSize     = new Vector2(236, 19);
            windowTitle.uiPosition = new Vector2(158.79f, 120);
            UiManager.CreateTextObj(windowRef, windowTitle);

            /*
             * if(TargetSprite == -1)
             * {
             *  windowTitle.uiText = "Resolution : " + " H : ?" + "px  W : ?" + " px";
             * }else{
             *  windowTitle.uiText = "Resolution : " + " H : "+ img.texture.height + "px  W : "+ img.texture.width + " px";
             * }
             */
            windowTitle.uiSize     = new Vector2(236, 19);
            windowTitle.uiPosition = new Vector2(158.79f, 100);
            UiManager.CreateTextObj(windowRef, windowTitle);

            UiButtonObject saveButton = new UiButtonObject();

            saveButton.uiPosition = new Vector2(210, -165);
            saveButton.uiSize     = new Vector2(70, 34);
            saveButton.uiButtonBackgroundObject.uiRayCast = true;
            saveButton.uiButtonBackgroundObject.uiSize    = saveButton.uiSize;

            saveButton.uiButtonBackgroundObject.uiColor      = new Color32(25, 25, 25, 255);
            saveButton.uiButtonBackgroundObject.normalColor  = new Color32(170, 170, 170, 100);
            saveButton.uiButtonBackgroundObject.hoverColor   = new Color32(134, 166, 255, 100);
            saveButton.uiButtonBackgroundObject.pressedColor = new Color32(0, 150, 255, 100);
            saveButton.uiButtonIcon.uiColor     = new Color32(24, 24, 24, 255);
            saveButton.uiButtonIcon.uiSize      = new Vector2(saveButton.uiSize.x - 2, saveButton.uiSize.y - 2);
            saveButton.uiButtonText             = new UiTextObject();
            saveButton.uiButtonText.uiTextColor = new Color32(255, 255, 255, 200);
            saveButton.uiButtonText.uiTextAlign = TextAnchor.MiddleCenter;
            saveButton.uiButtonText.uiText      = "Close";

            openBtn = UiManager.CreateButton(windowRef, saveButton).GetComponent <UiIntractable>();
            openBtn.onMouseClickEvent = WindowTerminate;

            saveButton.uiPosition          = new Vector2(58, -111);
            saveButton.uiSize              = new Vector2(34, 34);
            saveButton.uiButtonText.uiText = "";

            UiBackgroundObject icon = new UiBackgroundObject();

            icon.uiTextureRef = ScenePrimer.curEditorPrimer.editorIcons[33];
            icon.uiColor      = new Color(1, 1, 1, 1f);
            icon.uiSize       = new Vector2(22, 22);
            icon.uiPosition   = new Vector2(0, 0);

            saveButton.uiButtonIcon.uiSize             = new Vector2(saveButton.uiSize.x - 2, saveButton.uiSize.y - 2);
            saveButton.uiButtonBackgroundObject.uiSize = saveButton.uiSize;
            openBtn = UiManager.CreateButton(windowRef, saveButton).GetComponent <UiIntractable>();
            openBtn.onMouseClickEvent = AnimationToggel;
            UiManager.CreateBackgroundObj(openBtn.gameObject, icon);

            // Animation entity direction button up

            saveButton.uiPosition = new Vector2(96, -72.38f);

            icon.uiTextureRef = ScenePrimer.curEditorPrimer.editorIcons[38];

            openBtn = UiManager.CreateButton(windowRef, saveButton).GetComponent <UiIntractable>();
            openBtn.onMouseClickEvent = AnimationToggel;
            UiManager.CreateBackgroundObj(openBtn.gameObject, icon);

            // Animation entity direction button down

            saveButton.uiPosition = new Vector2(96, -111);

            icon.uiTextureRef = ScenePrimer.curEditorPrimer.editorIcons[47];

            openBtn = UiManager.CreateButton(windowRef, saveButton).GetComponent <UiIntractable>();
            openBtn.onMouseClickEvent = AnimationToggel;
            UiManager.CreateBackgroundObj(openBtn.gameObject, icon);

            // Animation entity direction button left

            saveButton.uiPosition = new Vector2(133.2f, -72.38f);

            icon.uiTextureRef = ScenePrimer.curEditorPrimer.editorIcons[39];

            openBtn = UiManager.CreateButton(windowRef, saveButton).GetComponent <UiIntractable>();
            openBtn.onMouseClickEvent = AnimationToggel;
            UiManager.CreateBackgroundObj(openBtn.gameObject, icon);

            // Animation entity direction button left

            saveButton.uiPosition = new Vector2(133.2f, -111);

            icon.uiTextureRef = ScenePrimer.curEditorPrimer.editorIcons[46];

            openBtn = UiManager.CreateButton(windowRef, saveButton).GetComponent <UiIntractable>();
            openBtn.onMouseClickEvent = AnimationToggel;
            UiManager.CreateBackgroundObj(openBtn.gameObject, icon);

            // Animation entity direction button right


            saveButton.uiPosition = new Vector2(58, -72.38f);
            icon.uiTextureRef     = ScenePrimer.curEditorPrimer.editorIcons[35];
            openBtn = UiManager.CreateButton(windowRef, saveButton).GetComponent <UiIntractable>();
            openBtn.onMouseClickEvent = AnimationLoop;
            UiManager.CreateBackgroundObj(openBtn.gameObject, icon);

            UiBackgroundObject transparacyBg = new UiBackgroundObject();

            transparacyBg.uiSize     = new Vector2(284.0696f, 284.0696f);
            transparacyBg.uiPosition = new Vector2(-108.0697f, 13f);
            transparacyBg.uiColor    = new Color32(255, 255, 255, 200);
            spritePrew          = UiManager.CreateBackgroundObj(windowRef, transparacyBg).GetComponent <Image>();
            spritePrew.material = Resources.Load("BerrySystem/Shaders/bgTranDark", typeof(Material)) as Material;

            UiBackgroundObject sprite = new UiBackgroundObject();

            transparacyBg.uiSize     = new Vector2(260, 260);
            transparacyBg.uiPosition = new Vector2(-109f, 12f);
            transparacyBg.uiColor    = new Color32(255, 255, 255, 0);
            spritePrew = UiManager.CreateBackgroundObj(windowRef, transparacyBg).GetComponent <Image>();
            //spritePrew.sprite = img;
            spritePrew.preserveAspect = true;

            //
            windowRef.AddComponent <QuickUiAnimator>().PlayPosAnim(new Vector2(0, 20), new Vector2(0, 0), false, false, 120f);
        }