示例#1
0
        public void CreateConsole(bool fullscreenMode = true)
        {
            fullscreen    = fullscreenMode;
            consoleCanvas = UiManager.CreateCanvas("console ui", this.gameObject);

            // Console Background.
            UiBackgroundObject consoleBackground = new UiBackgroundObject();

            consoleBackground.uiRayCast = false;
            consoleBackground.uiColor   = new Color(0, 0, 0);
            if (fullscreen)
            {
                consoleBackground.uiAnchorMode = UiManager.UiAnchorsMode.FillStretch;
                consoleBackground.uiSize       = new Vector2(0, 0);
            }
            else
            {
                consoleBackground.uiAnchorMode = UiManager.UiAnchorsMode.TopStretchHorizontal;
                consoleBackground.uiSize       = new Vector2(0, 400);
                consoleBackground.uiPosition   = new Vector2(0, 0);
            }
            consoleBackgroundObj = UiManager.CreateBackgroundObj(consoleCanvas, consoleBackground);

            // Console input.  ca 16px txh

            UiTextInputField uiMapName = new UiTextInputField();

            uiMapName.uiPosition                = new Vector2(0, 35);
            uiMapName.uiSize                    = new Vector2(0, 34);
            uiMapName.uiAnchorMode              = UiManager.UiAnchorsMode.BottomStretchHorizontal;
            uiMapName.uiButtonBackgroundObject  = null;
            uiMapName.uiButtonIcon.uiColor      = new Color(1, 1, 1, 1f);
            uiMapName.uiButtonIcon.uiAnchorMode = UiManager.UiAnchorsMode.BottomStretchHorizontal;
            uiMapName.uiButtonIcon.uiSize       = new Vector2(uiMapName.uiSize.x, 1);
            uiMapName.uiButtonIcon.uiPosition   = new Vector2(0, 20);
            uiMapName.fieldName                 = new UiTextObject();
            uiMapName.fieldName.uiText          = "  >";
            uiMapName.fieldName.uiAnchorMode    = UiManager.UiAnchorsMode.BottomStretchHorizontal;
            uiMapName.fieldName.uiSize          = new Vector2(0, 16);
            uiMapName.uiButtonText              = new UiTextObject();
            uiMapName.uiButtonText.uiTextColor  = new Color(1, 1, 1, 1);
            uiMapName.uiButtonText.uiAnchorMode = UiManager.UiAnchorsMode.BottomStretchHorizontal;

            uiMapName.uiButtonText.uiText = "";
            uiMapName.uiButtonText.uiSize = new Vector2(uiMapName.uiSize.x, -10);

            consoleInput                     = UiManager.CreateTextInputField(consoleCanvas, uiMapName);
            consoleInput.caretWidth          = 6;
            consoleInput.selectionColor      = new Color(0, 0, 1, 1);
            consoleInput.textComponent.color = new Color(1, 1, 1, 1);
            consoleInput.textComponent.rectTransform.anchorMin = new Vector2(.01f, 0);
            consoleInput.textComponent.fontSize = 12;
            //consoleInput.Select();
            consoleInput.ActivateInputField();
            consoleInput.onEndEdit.AddListener(delegate { submitToConsole(); });

            // Console log.
        }
        public override void WindowCreate(int sizeX, int sizeY, GameObject windowRef)
        {
            targetWindowRef = windowRef;
            // A realy bad way to overide.
            sizeX = 400;
            sizeY = 400;

            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);

            windowPanel.uiColor = new Color32(243, 243, 243, 255);
            windowPanel.uiSize  = new Vector2(sizeX, sizeY);
            UiManager.CreateBackgroundObj(windowRef, windowPanel);

            UiBackgroundObject editorIcon = new UiBackgroundObject();

            editorIcon.uiTextureRef = Resources.Load <Sprite>("BerrySystem/Icons/Main");
            editorIcon.uiObjName    = "EditorIcon";
            editorIcon.uiColor      = new Color32(219, 219, 219, 230);
            editorIcon.uiPosition   = new Vector2(10, 50);
            editorIcon.uiSize       = new Vector2(140, 140);
            UiManager.CreateBackgroundObj(windowRef, editorIcon);

            UiTextObject editorNameText = new UiTextObject();

            editorNameText.uiTextColor = new Color32(0, 0, 0, 255);
            editorNameText.uiSize      = new Vector2(150, 32);
            editorNameText.uiPosition  = new Vector2(0, -70);
            editorNameText.uiTextSize  = 25;
            editorNameText.uiText      = "Construi";
            editorNameText.uiTextAlign = TextAnchor.MiddleCenter;
            UiManager.CreateTextObj(windowRef, editorNameText);

            editorNameText.uiText     = "A L P H A 2";
            editorNameText.uiPosition = new Vector2(0, -100);
            editorNameText.uiTextSize = 18;
            UiManager.CreateTextObj(windowRef, editorNameText);

            /*
             * UiTextObject credit = new UiTextObject();
             * credit.uiTextColor = new Color32(0, 0, 0, 255);
             * credit.uiSize = new Vector2(160, 16);
             * credit.uiPosition = new Vector2(0, -150);
             * credit.uiTextSize = 12;
             * credit.uiText = "Made By Alve Larsson";
             * credit.uiTextAlign = TextAnchor.MiddleCenter;
             * UiManager.CreateTextObj(windowRef, credit).transform.parent.gameObject.AddComponent<QuickUiAnimator>().PlayFadeAnim(0, 1, false, false, 9f);
             */

            // Add a scale fade in.
            windowRef.AddComponent <QuickUiAnimator>().PlayPosAnim(new Vector2(0, 20), new Vector2(0, 0), false, false, 120f);
            //windowRef.AddComponent<QuickUiAnimator>().PlayScaleAnim(new Vector2(0, 0), new Vector2(1,1), false, false, 2f);
        }
示例#3
0
        public static GameObject CreateBackgroundObj(GameObject parrent, UiBackgroundObject newUiBackground)
        {
            GameObject backgroundObj = CreateUiObject(parrent, newUiBackground);
            Image      curImageComp  = backgroundObj.AddComponent <Image>();

            curImageComp.material      = Resources.Load("BerrySystem/UI/UI_Color", typeof(Material)) as Material;
            curImageComp.color         = newUiBackground.uiColor;
            curImageComp.raycastTarget = newUiBackground.uiRayCast;
            if (newUiBackground.uiTextureRef != null)
            {
                curImageComp.sprite = newUiBackground.uiTextureRef;
            }
            return(backgroundObj);
        }
示例#4
0
        public override void PrimerInitialize()
        {
            // Set the launchers window size. (This needs to be small so it can fit on smaller screens)
            Screen.SetResolution(545, 200, false);

            // Set the currently initialized primer info.
            primerModeName = "Launcher";
            launcherUI     = UiManager.CreateCanvas("LauncherUi", null, true, true, 0, true);

            UiBackgroundObject launcherBg = new UiBackgroundObject();

            launcherBg.uiAnchorMode = UiManager.UiAnchorsMode.TopStretchHorizontal;
            launcherBg.uiTextureRef = Resources.Load <Sprite>("BerrySystem/Icons/launcher_img");
            launcherBg.uiPosition   = new Vector2(0, -102);
            launcherBg.uiSize       = new Vector2(490, 200);
            UiManager.CreateBackgroundObj(launcherUI, launcherBg);

            UiTextObject launcherText = new UiTextObject();

            launcherText.uiText      = "Derelictus.";
            launcherText.uiTextSize  = 25;
            launcherText.uiSize      = new Vector2(200, 50);
            launcherText.uiPosition  = new Vector2(0, 30);
            launcherText.uiTextAlign = TextAnchor.MiddleCenter;
            UiManager.CreateTextObj(launcherUI, launcherText);

            launcherText.uiTextSize = 18;
            launcherText.uiText     = "Indev 0.1";
            launcherText.uiPosition = new Vector2(0, 0);
            UiManager.CreateTextObj(launcherUI, launcherText);

            UiButtonObject launcherPlayBtn = new UiButtonObject();

            launcherPlayBtn.uiAnchorMode             = UiManager.UiAnchorsMode.BottomRight;
            launcherPlayBtn.uiPosition               = new Vector2(-32, 32);
            launcherPlayBtn.uiButtonBackgroundObject = new UiInteractiveBackgroundObject();
            launcherPlayBtn.uiButtonIcon.uiRayCast   = true;
            UiManager.CreateButton(launcherUI, launcherPlayBtn);
        }
示例#5
0
        public override void WindowCreate(int sizeX, int sizeY, GameObject windowRef)
        {
            sizeX                     = 500;
            sizeY                     = 300;
            targetWindowRef           = windowRef;
            windowShadow.uiObjName    = "Shadow";
            windowShadow.uiTextureRef = Resources.Load <Sprite>("BerrySystem/UI/shadow");
            windowShadow.uiColor      = new Color32(0, 0, 0, 255);
            windowShadow.uiSize       = new Vector2(sizeX + 20, sizeY + 20);
            UiManager.CreateBackgroundObj(windowRef, windowShadow);

            windowRef.AddComponent <DebuggerMonoProbe>().probeUpdate = ProbeUpdate;
            windowRef.GetComponent <DebuggerMonoProbe>().probeTick   = ProbeTick;

            windowPanel.uiColor = new Color32(0, 0, 255, 255);
            windowPanel.uiSize  = new Vector2(sizeX, sizeY);
            UiManager.CreateBackgroundObj(windowRef, windowPanel);

            UiTextObject windowTitle = new UiTextObject();

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

            windowRef.transform.position = new Vector2(464, -242);

            probes     = new Image[1];
            probesTick = new bool[1];
            UiBackgroundObject probe = new UiBackgroundObject();

            probe.uiSize  = new Vector2(32, 32);
            probe.uiColor = new Color(1, 0, 0, 1);
            probes[0]     = UiManager.CreateBackgroundObj(windowRef, probe).GetComponent <Image>();
        }
示例#6
0
        public override void WindowCreate(int sizeX, int sizeY, GameObject windowRef)
        {
            targetWindowRef = windowRef;
            // A realy bad way to overide.
            sizeX = 400;
            sizeY = 280;

            // 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);

            // Window content...
            UiTextObject windowTitle = new UiTextObject();

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

            UiTextInputField uiMapName = new UiTextInputField();

            uiMapName.uiPosition = new Vector2(0, 30);
            uiMapName.uiSize     = new Vector2(362, 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      = "Map Name";
            InputField feildObj = UiManager.CreateTextInputField(windowRef, uiMapName);

            /*
             * uiMapName.fieldName.uiText = "Map File path";
             * uiMapName.uiPosition = new Vector2(0, -40);
             * UiManager.CreateTextInputField(windowRef, uiMapName);
             */

            UiButtonObject saveButton = new UiButtonObject();

            saveButton.uiPosition = new Vector2(156, -103);
            saveButton.uiSize     = new Vector2(50, 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;
            saveButton.uiButtonText.uiText      = "Create";

            MapNewBtn curMapNewBtn = UiManager.CreateButton(windowRef, saveButton).gameObject.AddComponent <MapNewBtn>();

            curMapNewBtn.targetField = feildObj;

            if (!ScenePrimer.curEditorPrimer.editorCreated)
            {
                saveButton.uiButtonText.uiText = "Cancel";
                saveButton.uiPosition          = new Vector2(100, -103);
                UiManager.CreateButton(windowRef, saveButton).gameObject.AddComponent <DropDownButton>().ACClick = WindowTerminate;
            }

            // Window content...
            UiTextObject ErrorTitle = new UiTextObject();

            ErrorTitle.uiTextColor = new Color(255, 0, 0, 255);
            ErrorTitle.uiText      = "There must be a name for a new map!";
            ErrorTitle.uiSize      = new Vector2(262, 21);
            ErrorTitle.uiPosition  = new Vector2(-50, 0);
            curMapNewBtn.Error     = UiManager.CreateTextObj(windowRef, ErrorTitle);
            curMapNewBtn.Error.SetActive(false);

            UiBackgroundObject errorBg = new UiBackgroundObject();

            errorBg.uiColor    = new Color(1, 0, 0, 0.1f);
            errorBg.uiPosition = new Vector2(50, 30);
            errorBg.uiSize     = new Vector2(364, 36);
            UiManager.CreateBackgroundObj(curMapNewBtn.Error, errorBg);


            //
            windowRef.AddComponent <QuickUiAnimator>().PlayPosAnim(new Vector2(0, 20), new Vector2(0, 0), false, false, 120f);
        }
示例#7
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);

            UiTextObject windowTitle = new UiTextObject();

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

            newXCPInstance = new XCP();

            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.uiSize      = saveButton.uiSize;
            saveButton.uiButtonText.uiTextColor = new Color32(0, 0, 0, 255);
            saveButton.uiButtonText.uiTextAlign = TextAnchor.MiddleCenter;
            saveButton.uiButtonText.uiText      = "Create";

            UiManager.CreateButton(windowRef, saveButton).gameObject.AddComponent <DropDownButton>().ACClick = CreateXCP;


            if (!ScenePrimer.curEditorPrimer.editorCreated)
            {
                saveButton.uiButtonText.uiText = "Cancel";
                saveButton.uiPosition          = new Vector2(130, -165);
                UiManager.CreateButton(windowRef, saveButton).gameObject.AddComponent <DropDownButton>().ACClick = WindowTerminate;
            }

            saveButton.uiPosition = new Vector2(0, -165);
            saveButton.uiSize     = new Vector2(90, 34);
            saveButton.uiButtonBackgroundObject.uiSize = saveButton.uiSize;
            saveButton.uiButtonIcon.uiSize             = new Vector2(saveButton.uiSize.x - 2, saveButton.uiSize.y - 2);
            saveButton.uiButtonText.uiText             = "Import icon";
            UiManager.CreateButton(windowRef, saveButton).gameObject.AddComponent <DropDownButton>().ACClick = IconImport;

            UiTextInputField uiMapName = new UiTextInputField();

            uiMapName.uiPosition = new Vector2(0, 116);
            uiMapName.uiSize     = new Vector2(470, 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          = null;
            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      = "XCP Name / Game Name";
            fieldObj = UiManager.CreateTextInputField(windowRef, uiMapName);
            fieldObj.onEndEdit.AddListener(delegate { NameUpdate(); });

            uiMapName.fieldName.uiText = "Author";
            uiMapName.uiPosition       = new Vector2(0, 40);
            fieldObj1 = UiManager.CreateTextInputField(windowRef, uiMapName);
            fieldObj1.onEndEdit.AddListener(delegate { AuthorUpdate(); });

            uiMapName.fieldName.uiText = "Description";
            uiMapName.uiPosition       = new Vector2(0, -40);
            fieldObj2 = UiManager.CreateTextInputField(windowRef, uiMapName);
            fieldObj2.onEndEdit.AddListener(delegate { DescriptionUpdate(); });

            UiBackgroundObject icon = new UiBackgroundObject();

            icon.uiSize     = new Vector2(92, 92);
            icon.uiPosition = new Vector2(-120, -120);
            icon.uiColor    = new Color32(230, 230, 230, 255);
            iconPrew        = UiManager.CreateBackgroundObj(windowRef, icon).GetComponent <Image>();

            //
            windowRef.AddComponent <QuickUiAnimator>().PlayPosAnim(new Vector2(0, 20), new Vector2(0, 0), false, false, 120f);
        }
示例#8
0
        public static GameObject CreateColorInputField(GameObject parrent, UiTextInputField textInputObj, Color32 PresetColor = new Color32(), OptionRunner PassType = null)
        {
            textInputObj.uiObjName = "colorField";
            GameObject inputObj          = CreateButton(parrent, textInputObj, true).gameObject;
            GameObject inputContainerObj = new GameObject("colorObj");

            inputContainerObj.transform.SetParent(inputObj.transform);
            GameObject         description = CreateTextObj(inputObj, textInputObj.fieldName);
            UiBackgroundObject colorPlane  = new UiBackgroundObject();

            colorPlane.uiSize.y     = textInputObj.uiSize.y;
            colorPlane.uiSize.x     = 32;
            colorPlane.uiColor      = new Color(0, 0, 0, 1);
            colorPlane.uiPosition.x = 76;
            GameObject ColorPlane = CreateBackgroundObj(inputObj, colorPlane);

            UiSliderObject slider0 = new UiSliderObject();

            slider0.uiButtonBackgroundObject        = new UiInteractiveBackgroundObject();
            slider0.uiButtonBackgroundObject.uiSize = new Vector2(textInputObj.uiSize.x - 32, 32);
            slider0.uiPosition = new Vector2(-16, 32);
            slider0.uiButtonBackgroundObject.normalColor = new Color(1, 1, 1, 0.3f);
            slider0.uiButtonBackgroundObject.uiRayCast   = true;
            slider0.uiButtonIcon             = null;
            slider0.uiButtonText             = new UiTextObject();
            slider0.uiButtonText.uiText      = "   R";
            slider0.uiButtonText.uiSize      = new Vector2(textInputObj.uiSize.x - 32, 32);
            slider0.uiButtonText.uiTextColor = new Color(0, 0, 0, 1);

            Slider Slider0 = CreateSlider(inputObj, slider0);

            slider0.uiButtonBackgroundObject.uiSize = new Vector2(textInputObj.uiSize.x - 32, 32);
            slider0.uiPosition          = new Vector2(-16, 0);
            slider0.uiButtonText.uiText = "   G";

            Slider Slider1 = CreateSlider(inputObj, slider0);

            slider0.uiButtonBackgroundObject.uiSize = new Vector2(textInputObj.uiSize.x - 32, 32);
            slider0.uiPosition          = new Vector2(-16, -32);
            slider0.uiButtonText.uiText = "   B";

            Slider Slider2 = CreateSlider(inputObj, slider0);

            if (textInputObj.uiButtonText == null)
            {
                textInputObj.uiButtonText        = new UiTextObject();
                textInputObj.uiButtonText.uiText = "";
            }
            ColorPanel curColorPanel = inputObj.AddComponent <ColorPanel>();

            curColorPanel.sliderR   = Slider0;
            curColorPanel.sliderG   = Slider1;
            curColorPanel.sliderB   = Slider2;
            curColorPanel.prewPlane = ColorPlane.GetComponent <Image>();
            curColorPanel.target    = PassType;
            curColorPanel.SetColorNew(PresetColor);

            Slider0.onValueChanged.AddListener(delegate { curColorPanel.UpdateColor(); });
            Slider1.onValueChanged.AddListener(delegate { curColorPanel.UpdateColor(); });
            Slider2.onValueChanged.AddListener(delegate { curColorPanel.UpdateColor(); });

            textInputObj.uiButtonText.uiTextColor = new Color32(0, 0, 0, 255);
            textInputObj.uiButtonText.uiSize      = new Vector2(textInputObj.uiSize.x - 15, textInputObj.uiSize.y);
            GameObject text = CreateTextObj(inputObj, textInputObj.uiButtonText);

            return(null);
        }
示例#9
0
        public override void WindowCreate(int sizeX, int sizeY, GameObject windowRef)
        {
            targetWindowRef = windowRef;
            // A realy bad way to overide.
            sizeX = 400;
            sizeY = 400;

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

            windowPanel.uiColor   = new Color32(13, 15, 15, 255);
            windowPanel.uiSize    = new Vector2(sizeX, sizeY);
            windowPanel.uiRayCast = true;
            UiManager.CreateBackgroundObj(windowRef, windowPanel);

            UiBackgroundObject editorIcon = new UiBackgroundObject();

            editorIcon.uiTextureRef = Resources.Load <Sprite>("BerrySystem/Icons/xdp");
            editorIcon.uiObjName    = "EditorIcon";
            editorIcon.uiColor      = new Color32(219, 219, 219, 230);
            editorIcon.uiPosition   = new Vector2(0, 60);
            editorIcon.uiSize       = new Vector2(150, 150);
            UiManager.CreateBackgroundObj(windowRef, editorIcon);

            UiTextObject editorNameText = new UiTextObject();

            editorNameText.uiTextColor = new Color32(239, 239, 255, 255);
            editorNameText.uiSize      = new Vector2(300, 32);
            editorNameText.uiPosition  = new Vector2(0, -70);
            editorNameText.uiTextSize  = 25;
            editorNameText.uiText      = "XDP";
            editorNameText.uiTextAlign = TextAnchor.MiddleCenter;
            UiManager.CreateTextObj(windowRef, editorNameText);

            editorNameText.uiText     = "Service not ready...";
            editorNameText.uiPosition = new Vector2(0, -100);
            editorNameText.uiTextSize = 18;
            UiManager.CreateTextObj(windowRef, editorNameText);

            UiTextObject credit = new UiTextObject();

            credit.uiTextColor = new Color32(239, 239, 255, 255);
            credit.uiSize      = new Vector2(160, 16);
            credit.uiPosition  = new Vector2(0, -150);
            credit.uiTextSize  = 12;
            credit.uiText      = "Copyright Xnomoto 2018.";
            credit.uiTextAlign = TextAnchor.MiddleCenter;
            UiManager.CreateTextObj(windowRef, credit).transform.parent.gameObject.AddComponent <QuickUiAnimator>().PlayFadeAnim(0, 1, false, false, 9f);

            if (!ScenePrimer.curEditorPrimer.editorCreated)
            {
                UiButtonObject saveButton = new UiButtonObject();
                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.uiSize      = saveButton.uiSize;
                saveButton.uiButtonText.uiTextColor = new Color32(0, 0, 0, 255);
                saveButton.uiButtonText.uiTextAlign = TextAnchor.MiddleCenter;

                saveButton.uiButtonText.uiText = "Close";
                saveButton.uiPosition          = new Vector2(140, -165);
                UiManager.CreateButton(windowRef, saveButton).gameObject.AddComponent <DropDownButton>().ACClick = WindowTerminate;
            }
            // Add a scale fade in.
            windowRef.AddComponent <QuickUiAnimator>().PlayPosAnim(new Vector2(0, 20), new Vector2(0, 0), false, false, 120f);
            //windowRef.AddComponent<QuickUiAnimator>().PlayScaleAnim(new Vector2(0, 0), new Vector2(1,1), false, false, 2f);
        }
示例#10
0
        public override void WindowCreate(int sizeX, int sizeY, GameObject windowRef)
        {
            targetWindowRef = windowRef;
            // A realy bad way to overide.
            sizeX = 400;
            sizeY = 280;

            // 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);

            // Window content...
            UiTextObject windowTitle = new UiTextObject();

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

            UiTextInputField uiMapName = new UiTextInputField();

            uiMapName.uiPosition = new Vector2(0, 30);
            uiMapName.uiSize     = new Vector2(362, 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      = "Map Name";
            InputField feildObj0 = UiManager.CreateTextInputField(windowRef, uiMapName);

            uiMapName.fieldName.uiText = "Map File path";
            uiMapName.uiPosition       = new Vector2(0, -50);
            InputField feildObj1 = UiManager.CreateTextInputField(windowRef, uiMapName);

            UiButtonObject saveButton = new UiButtonObject();

            saveButton.uiPosition = new Vector2(156, -103);
            saveButton.uiSize     = new Vector2(50, 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;
            saveButton.uiButtonText.uiText      = "Open";

            BMapImportBtn curBSaveMapAs = UiManager.CreateButton(windowRef, saveButton).gameObject.AddComponent <BMapImportBtn>();

            curBSaveMapAs.targetFeild0 = feildObj0;
            curBSaveMapAs.targetFeild1 = feildObj1;

            UiTextObject ErrorTitle = new UiTextObject();

            ErrorTitle.uiTextColor = new Color(255, 0, 0, 255);
            ErrorTitle.uiText      = "There must be a name for the map!";
            ErrorTitle.uiSize      = new Vector2(262, 21);
            ErrorTitle.uiPosition  = new Vector2(-50, 0);
            curBSaveMapAs.error0   = UiManager.CreateTextObj(windowRef, ErrorTitle);
            curBSaveMapAs.error0.SetActive(false);

            UiBackgroundObject errorBg = new UiBackgroundObject();

            errorBg.uiColor    = new Color(1, 0, 0, 0.1f);
            errorBg.uiPosition = new Vector2(50, 30);
            errorBg.uiSize     = new Vector2(364, 36);
            UiManager.CreateBackgroundObj(curBSaveMapAs.error0, errorBg);

            UiTextObject ErrorTitle1 = new UiTextObject();

            ErrorTitle1.uiTextColor = new Color(255, 0, 0, 255);
            ErrorTitle1.uiText      = "There must be a valid file path so the map can be saved!!";
            ErrorTitle1.uiSize      = new Vector2(262, 21);
            ErrorTitle1.uiPosition  = new Vector2(-50, -80);
            curBSaveMapAs.error1    = UiManager.CreateTextObj(windowRef, ErrorTitle1);
            curBSaveMapAs.error1.SetActive(false);

            UiBackgroundObject errorBg1 = new UiBackgroundObject();

            errorBg1.uiColor    = new Color(1, 0, 0, 0.1f);
            errorBg1.uiPosition = new Vector2(50, 30);
            errorBg1.uiSize     = new Vector2(364, 36);
            UiManager.CreateBackgroundObj(curBSaveMapAs.error1, errorBg1);

            //
            windowRef.AddComponent <QuickUiAnimator>().PlayPosAnim(new Vector2(0, 20), new Vector2(0, 0), false, false, 120f);
        }
示例#11
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);

            UiTextObject windowTitle = new UiTextObject();

            windowTitle.uiTextColor = new Color(0, 0, 0, 255);
            windowTitle.uiText      = WindowGrabName();
            windowTitle.uiSize      = new Vector2(100, 19);
            windowTitle.uiTextAlign = TextAnchor.UpperCenter;
            windowTitle.uiPosition  = new Vector2(0, 180);
            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(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;
            saveButton.uiButtonText.uiText      = "Open";

            openBtn = UiManager.CreateButton(windowRef, saveButton).GetComponent <UiIntractable>();
            openBtn.gameObject.SetActive(false);
            openBtn.onMouseClickEvent = OpenMap;

            saveButton.uiButtonText.uiText = "New Map";
            saveButton.uiSize     = new Vector2(100, 34);
            saveButton.uiPosition = new Vector2(130, -165);
            newBtn = UiManager.CreateButton(windowRef, saveButton).GetComponent <UiIntractable>();
            newBtn.onMouseClickEvent = NewMap;
            if (XCPManager.currentXCP == null)
            {
                newBtn.gameObject.SetActive(false);
            }

            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);

            saveButton.uiButtonText.uiText = "Load";
            saveButton.uiPosition          = new Vector2(-8, -162);
            UiManager.CreateButton(windowRef, saveButton).gameObject.AddComponent <DropDownButton>().ACClick = XCPLoad;

            saveButton.uiButtonText.uiText = "Create";
            saveButton.uiPosition          = new Vector2(-85, -162);
            DropDownOption xcpCreate = new DropDownOption(); // Move over to the new way of doing things....

            xcpCreate.targetNewWindow = new BXCPCreate();

            xcpCreate.destroy = true;
            UiManager.CreateButton(windowRef, saveButton).gameObject.AddComponent <DropDownButton>().optionData = xcpCreate;

            if (ScenePrimer.curEditorPrimer.editorCreated)
            {
                saveButton.uiButtonText.uiText = "Save";
                saveButton.uiPosition          = new Vector2(-205, -162);
                xcpCreate.destroy = true;
                UiManager.CreateButton(windowRef, saveButton).gameObject.AddComponent <DropDownButton>().ACClick = SaveXCP;
            }

            UiBackgroundObject icon = new UiBackgroundObject();

            icon.uiSize     = new Vector2(92, 92);
            icon.uiPosition = new Vector2(-197.8f, 101.7f);
            icon.uiColor    = new Color32(243, 243, 243, 255);
            iconPrew        = UiManager.CreateBackgroundObj(windowRef, icon).GetComponent <Image>();

            UiTextObject xcpTitle = new UiTextObject();

            if (XCPManager.currentXCP == null)
            {
                xcpTitle.uiText = "NO XCP LOADED !";
            }
            else
            {
                xcpTitle.uiText = XCPManager.currentXCP.xcpGameName;
            }
            xcpTitle.uiTextSize  = 15;
            xcpTitle.uiTextColor = new Color(0, 0, 0, 1);
            xcpTitle.uiPosition  = new Vector2(-59.55f, 127.11f);
            xcpTitle.uiSize      = new Vector2(170.72f, 34);
            curXPCName           = UiManager.CreateTextObj(windowRef, xcpTitle).GetComponent <Text>();
            xcpTitle.uiText      = "";
            xcpTitle.uiTextSize  = 13;
            xcpTitle.uiPosition  = new Vector2(-59.55f, 104.4f);
            curXPCAuthor         = UiManager.CreateTextObj(windowRef, xcpTitle).GetComponent <Text>();
            xcpTitle.uiPosition  = new Vector2(-157.5f, -126.8f);
            curXPCVer            = UiManager.CreateTextObj(windowRef, xcpTitle).GetComponent <Text>();
            xcpTitle.uiSize      = new Vector2(269, 34);
            xcpTitle.uiPosition  = new Vector2(-110, 28);
            curXPCDescript       = UiManager.CreateTextObj(windowRef, xcpTitle).GetComponent <Text>();

            if (XCPManager.currentXCP != null)
            {
                curXPCName.text     = XCPManager.currentXCP.xcpGameName;
                curXPCAuthor.text   = XCPManager.currentXCP.xcpAuthor;
                curXPCDescript.text = XCPManager.currentXCP.xcpDescription;
                curXPCVer.text      = "V." + XCPManager.currentXCP.xcpFormVersion.ToString();
                iconPrew.sprite     = XCPManager.PngToSprite(XCPManager.currentXCP.xcpIcon);
            }

            UiItemFeild uiFileBrowser = new UiItemFeild();

            uiFileBrowser.uiPosition = new Vector2(146.78f, 9.19f);
            uiFileBrowser.uiSize     = new Vector2(209.7f, 291.82f);
            uiFileBrowser.uiColor    = new Color32(239, 239, 239, 255);
            newField = UiManager.CreateItemsFeild(windowRef, uiFileBrowser);

            xcpTitle.uiPosition = new Vector2(200f, 127.11f);
            xcpTitle.uiSize     = new Vector2(170.72f, 34);
            xcpTitle.uiText     = "No maps!";
            noMaps = UiManager.CreateTextObj(windowRef, xcpTitle).GetComponent <Text>();


            GenerateMapView();
            //
            windowRef.AddComponent <QuickUiAnimator>().PlayPosAnim(new Vector2(0, 20), new Vector2(0, 0), false, false, 120f);
        }
示例#12
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(142, 13);
            xpcInfoPanel.uiSize     = new Vector2(205, 285);
            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);

            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;

            // The old way of doing things... but this needs to be node fast.
            UiButtonObject editorFileMenu = new UiButtonObject();

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

            editorFileMenu.uiButtonText             = new UiTextObject();
            editorFileMenu.uiButtonText.uiTextAlign = TextAnchor.MiddleCenter;
            editorFileMenu.uiButtonText.uiText      = "Import Texture";
            editorFileMenu.uiButtonText.uiTextColor = new Color(0, 0, 0, 1);
            editorFileMenu.uiButtonText.uiSize      = new Vector2(100, 30);

            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(58, 0);

            editorFileMenu.uiButtonBackgroundObject.uiRayCast    = true;
            editorFileMenu.uiButtonBackgroundObject.uiSize       = new Vector2(145, 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(windowRef, editorFileMenu).gameObject.AddComponent <editorTextureDropDown>();

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

            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);
        }
示例#13
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);
        }
示例#14
0
        // Custom functions
        public void CreatePanelList(GameObject parrent)
        {
            GameObject panelObj = UiManager.sCreateUiObject(parrent, uiObj);

            // Set the defult width and hight if the parrent is filling the screen / area
            if (uiObj.uiAnchorMode == UiManager.UiAnchorsMode.FillStretch)
            {
                width = (int)parrent.GetComponent <RectTransform>().sizeDelta.x;
                hight = (int)parrent.GetComponent <RectTransform>().sizeDelta.y;
            }

            // Add the scrolling functions to the stack area
            ScrollRect stackScrollArea = panelObj.AddComponent <ScrollRect>();
            GameObject pStackView      = new GameObject("listView");

            pStackView.transform.SetParent(panelObj.transform);
            GameObject pStackContnet = new GameObject("listContent");

            pStackContnet.transform.SetParent(pStackView.transform);
            stackScrollArea.content = pStackContnet.AddComponent <RectTransform>();
            pStackContnet.AddComponent <Image>();
            stackScrollArea.content.anchorMin = new Vector2();
            stackScrollArea.content.anchorMax = new Vector2(1, 1);
            stackScrollArea.content.sizeDelta = new Vector2(0, 0);
            stackScrollArea.content.offsetMax = new Vector2();
            stackScrollArea.content.offsetMin = new Vector2();
            stackScrollArea.vertical          = true;
            stackScrollArea.horizontal        = false;
            stackScrollArea.movementType      = ScrollRect.MovementType.Elastic;
            stackScrollArea.elasticity        = 0.05f;
            stackScrollArea.inertia           = true;
            stackScrollArea.decelerationRate  = 0.15f;
            stackScrollArea.scrollSensitivity = 2;
            stackScrollArea.viewport          = pStackView.AddComponent <RectTransform>();
            pStackView.AddComponent <RectMask2D>();
            stackScrollArea.viewport.anchorMin = new Vector2();
            stackScrollArea.viewport.anchorMax = new Vector2(1, 1);
            stackScrollArea.viewport.sizeDelta = new Vector2(0, 0);
            stackScrollArea.viewport.offsetMax = new Vector2();
            stackScrollArea.viewport.offsetMin = new Vector2();
            stackScrollArea.verticalScrollbar  = new GameObject("ScrollBar").AddComponent <Scrollbar>();
            stackScrollArea.verticalScrollbar.transform.SetParent(panelObj.transform);
            stackScrollArea.verticalScrollbar.direction = Scrollbar.Direction.BottomToTop;
            stackScrollArea.verticalScrollbar.GetComponent <RectTransform>().anchorMin = new Vector2(1, 0);
            stackScrollArea.verticalScrollbar.GetComponent <RectTransform>().anchorMax = new Vector2(1, 1);
            stackScrollArea.verticalScrollbar.GetComponent <RectTransform>().sizeDelta = new Vector2(8000, 0);
            stackScrollArea.verticalScrollbar.GetComponent <RectTransform>().rect.Set(20, 20, 8, 0);
            stackScrollArea.verticalScrollbar.GetComponent <RectTransform>().offsetMax = new Vector2();
            stackScrollArea.verticalScrollbar.GetComponent <RectTransform>().offsetMin = new Vector2();
            UiBackgroundObject scrollBar = new UiBackgroundObject();

            scrollBar.uiRayCast    = true;
            scrollBar.uiSize       = new Vector2();
            scrollBar.uiAnchorMode = UiManager.UiAnchorsMode.FillStretch;
            stackScrollArea.verticalScrollbar.targetGraphic = UiManager.CreateBackgroundObj(stackScrollArea.verticalScrollbar.gameObject, scrollBar).GetComponent <Image>();
            stackScrollArea.verticalScrollbar.handleRect    = stackScrollArea.verticalScrollbar.targetGraphic.GetComponent <RectTransform>();

            if (stackItems != null)
            {
                for (int i = 0; i < stackItems.Length; i++)
                {
                    stackHight += padding;

                    if (stackItems[i] != null)
                    {
                        stackItems[i].uiObjName    = "KEK";
                        stackItems[i].uiSize       = new Vector2(width, 32);
                        stackItems[i].uiAnchorMode = UiManager.UiAnchorsMode.TopCenter;
                        stackItems[i].uiPosition   = new Vector2(stackHight, 0);
                        stackItems[i].CreateUiType(pStackContnet);
                    }
                }
            }
            stackHight = 700;

            if (stackHight >= hight)
            {
                stackHight = hight - stackHight;
                stackScrollArea.content.offsetMin = new Vector2(stackScrollArea.content.offsetMin.x, stackHight);
            }
        }
示例#15
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();
        }
示例#16
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.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.itemTextures[TargetSprite]);
                windowTitle.uiText = "Pixsel scale : " + XCPManager.currentXCP.itemTextures[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(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;
            saveButton.uiButtonText.uiText      = "Close";

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

            saveButton.uiButtonText.uiText = "Remove";
            saveButton.uiSize     = new Vector2(100, 34);
            saveButton.uiPosition = new Vector2(130, -165);
            newBtn = UiManager.CreateButton(windowRef, saveButton).GetComponent <UiIntractable>();
            newBtn.onMouseClickEvent = SpriteRemove;

            saveButton.uiButtonText.uiText = "Remove";
            saveButton.uiButtonBackgroundObject.uiColor     = new Color32(255, 0, 0, 255);
            saveButton.uiButtonBackgroundObject.normalColor = new Color32(255, 0, 0, 255);
            saveButton.uiButtonBackgroundObject.hoverColor  = new Color32(255, 0, 0, 100);
            saveButton.uiButtonIcon.uiColor = new Color32(255, 255, 255, 50);
            saveButton.uiSize     = new Vector2(100, 34);
            saveButton.uiPosition = new Vector2(130, -125);
            newBtn = UiManager.CreateButton(windowRef, saveButton).GetComponent <UiIntractable>();
            newBtn.onMouseClickEvent = SpriteRemove;
            newBtn.gameObject.SetActive(false);

            saveButton.uiButtonText.uiText = "Import Texture";
            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 = SpriteEdit;

            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/tran", 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, 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);
        }
示例#17
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.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);

            windowTitle.uiTextAlign = TextAnchor.MiddleLeft;
            windowTitle.uiText      = "Sprite collider size :";
            windowTitle.uiPosition  = new Vector2(131, 80);
            UiManager.CreateTextObj(windowRef, windowTitle);

            windowTitle.uiTextAlign = TextAnchor.MiddleLeft;
            windowTitle.uiText      = "Sprite collider position :";
            windowTitle.uiPosition  = new Vector2(131, 30);
            UiManager.CreateTextObj(windowRef, windowTitle);

            img = XCPManager.PngToSprite(XCPManager.currentXCP.spriteTextures[TargetSprite]);

            windowTitle.uiText     = "Pixsel scale : " + XCPManager.currentXCP.spriteTextures[TargetSprite].pixScale;
            windowTitle.uiSize     = new Vector2(236, 19);
            windowTitle.uiPosition = new Vector2(158.79f, 120);
            UiManager.CreateTextObj(windowRef, windowTitle);

            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(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;
            saveButton.uiButtonText.uiText      = "Close";

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

            /*
             * saveButton.uiButtonText.uiText = "Remove";
             * saveButton.uiSize = new Vector2(100, 34);
             * saveButton.uiPosition = new Vector2(130, -165);
             * newBtn = UiManager.CreateButton(windowRef, saveButton).GetComponent<UiIntractable>();
             * newBtn.onMouseClickEvent = SpriteRemove;
             *
             * saveButton.uiButtonText.uiText = "Remove";
             * saveButton.uiButtonBackgroundObject.uiColor = new Color32(255, 0, 0, 255);
             * saveButton.uiButtonBackgroundObject.normalColor = new Color32(255, 0, 0, 255);
             * saveButton.uiButtonBackgroundObject.hoverColor = new Color32(255, 0, 0, 100);
             * saveButton.uiButtonIcon.uiColor = new Color32(255, 255, 255, 50);
             * saveButton.uiSize = new Vector2(100, 34);
             * saveButton.uiPosition = new Vector2(130, -125);
             * newBtn = UiManager.CreateButton(windowRef, saveButton).GetComponent<UiIntractable>();
             * newBtn.onMouseClickEvent = SpriteRemove;
             * newBtn.gameObject.SetActive(false);
             */


            saveButton.uiButtonText.uiText = "Done";
            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.uiButtonIcon.uiColor = new Color32(255, 255, 255, 110);
            saveButton.uiSize             = new Vector2(100, 34);
            saveButton.uiPosition         = new Vector2(-210.2f, -165);
            editDoneBtn                   = UiManager.CreateButton(windowRef, saveButton).GetComponent <UiIntractable>();
            editDoneBtn.onMouseClickEvent = SpriteEditDone;
            editDoneBtn.gameObject.SetActive(false);

            /*
             * saveButton.uiButtonText.uiText = "Is AI";
             * 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.uiButtonIcon.uiColor = new Color32(255, 255, 255, 110);
             * saveButton.uiSize = new Vector2(100, 34);
             * saveButton.uiPosition = new Vector2(210, -125);
             * editDoneBtn = UiManager.CreateButton(windowRef, saveButton).GetComponent<UiIntractable>();
             * editDoneBtn.onMouseClickEvent = SpriteEditDone;
             */

            saveButton.uiButtonText.uiText = "Set sorting point";
            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 = SpriteEdit;

            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);
            transparacyBg.uiColor    = new Color32(255, 255, 255, 255);
            spritePrew                = UiManager.CreateBackgroundObj(windowRef, transparacyBg).GetComponent <Image>();
            spritePrew.sprite         = img;
            spritePrew.preserveAspect = true;

            UiSliderObject slider0 = new UiSliderObject();

            slider0.uiButtonBackgroundObject        = new UiInteractiveBackgroundObject();
            slider0.uiButtonBackgroundObject.uiSize = new Vector2(200, 32);
            slider0.uiPosition = new Vector2(-73.8f, -163.8f);
            slider0.uiButtonBackgroundObject.normalColor = new Color(1, 1, 1, 0.3f);
            slider0.uiButtonBackgroundObject.uiRayCast   = true;
            slider0.uiButtonIcon             = null;
            slider0.uiButtonText             = new UiTextObject();
            slider0.uiButtonText.uiText      = "   Sorting Point";
            slider0.uiButtonText.uiSize      = new Vector2(200, 32);
            slider0.uiButtonText.uiTextColor = new Color(0, 0, 0, 1);

            Slider0              = UiManager.CreateSlider(windowRef, slider0);
            Slider0.maxValue     = 1;
            Slider0.minValue     = 0;
            Slider0.wholeNumbers = false;
            Slider0.gameObject.SetActive(false);
            Slider0.value = XCPManager.currentXCP.spriteTextures[TargetSprite].sortPoint;
            Slider0.onValueChanged.AddListener(delegate { SortUpdate(); });

            UiBackgroundObject sortPoint = new UiBackgroundObject();

            sortPoint.uiPosition = new Vector2(-109f, 12f);
            sortPoint.uiSize     = new Vector2(8, 8);
            sortPoint.uiColor    = new Color(1, 0.2f, 0.2f, 1);
            sortPointObj         = UiManager.CreateBackgroundObj(windowRef, sortPoint).GetComponent <Image>();
            sortPointObj.transform.localPosition = new Vector3(-109f, Slider0.value * 260 - 120, 0);

            UiBackgroundObject ColiderBox = new UiBackgroundObject();

            ColiderBox.uiTextureRef = Resources.Load <Sprite>("BerrySystem/Textures/Misc/trigger");
            ColiderBox.uiPosition   = new Vector2(-109f, 12f);
            ColiderBox.uiSize       = new Vector2(16, 16);
            ColiderBox.uiColor      = new Color(0, 1f, 0f, 1);
            ColiderBoxObj           = UiManager.CreateBackgroundObj(windowRef, ColiderBox).GetComponent <Image>();


            //
            windowRef.AddComponent <QuickUiAnimator>().PlayPosAnim(new Vector2(0, 20), new Vector2(0, 0), false, false, 120f);
        }
示例#18
0
        public override void Click()
        {
            GameObject curFocus = UiManager.CreateUiFocusObj();

            // Create the panels background shadow.
            UiBackgroundObject editorInfoPanelShadow = new UiBackgroundObject();

            editorInfoPanelShadow.uiObjName    = "editorInfoPanelShadow";
            editorInfoPanelShadow.uiTextureRef = Resources.Load <Sprite>("BerrySystem/UI/shadow");
            editorInfoPanelShadow.uiSize       = new Vector2(450, 350);
            editorInfoPanelShadow.uiColor      = new Color(0, 0, 0, 0.7f);
            GameObject shadow = UiManager.CreateBackgroundObj(curFocus, editorInfoPanelShadow);

            // Create the actual panel.
            UiBackgroundObject editorInfoPanel = new UiBackgroundObject();

            editorInfoPanel.uiObjName = "EditorInfoPanel";
            editorInfoPanel.uiSize    = new Vector2(400, 300);
            editorInfoPanel.uiColor   = new Color(1, 1, 1, 1);
            editorInfoPanel.uiRayCast = true;
            GameObject curPanel = UiManager.CreateBackgroundObj(curFocus, editorInfoPanel);

            // Play the pop in intro animation.
            shadow.AddComponent <QuickUiAnimator>().PlayFadeAnim(0, 1, false, false, 9f);
            shadow.AddComponent <QuickUiAnimator>().PlayPosAnim(new Vector2(0, -20), new Vector2(0, 0), false, false, 120f);

            // Create the panel logo.
            UiBackgroundObject editorLogo = new UiBackgroundObject();

            editorLogo.uiObjName    = "editorLogo";
            editorLogo.uiTextureRef = Resources.Load <Sprite>("BerrySystem/Icons/mapBerryIcon");
            editorLogo.uiSize       = new Vector2(250, 250);
            editorLogo.uiColor      = new Color(1, 1, 1, 0.1f);
            UiManager.CreateBackgroundObj(curFocus, editorLogo);

            // Editor name!
            UiTextObject editorName = new UiTextObject();

            editorName.uiObjName    = "editorName";
            editorName.uiText       = "MapBerry";
            editorName.uiTextSize   = 30;
            editorName.uiTextAlign  = TextAnchor.MiddleCenter;
            editorName.uiSize       = new Vector2(40, 40);
            editorName.uiTextColor  = new Color();
            editorName.uiAnchorMode = UiManager.UiAnchorsMode.MiddelStretchHorizontal;
            UiManager.CreateTextObj(curPanel, editorName);

            // Editor Stage Version
            UiTextObject editorStageVersion = new UiTextObject();

            editorStageVersion.uiObjName    = "editorStageVersion";
            editorStageVersion.uiText       = "A L P H A";
            editorStageVersion.uiTextSize   = 16;
            editorStageVersion.uiTextAlign  = TextAnchor.MiddleCenter;
            editorStageVersion.uiPosition   = new Vector2(0, -10);
            editorStageVersion.uiSize       = new Vector2(40, 40);
            editorStageVersion.uiTextColor  = new Color();
            editorStageVersion.uiAnchorMode = UiManager.UiAnchorsMode.MiddelStretchHorizontal;
            UiManager.CreateTextObj(curPanel, editorStageVersion);

            // Editor Version
            UiTextObject editorVersion = new UiTextObject();

            editorVersion.uiObjName    = "editorVersion";
            editorVersion.uiText       = curEditorObj.editorVersionNumberDisplay;
            editorVersion.uiTextSize   = 12;
            editorVersion.uiTextAlign  = TextAnchor.MiddleCenter;
            editorVersion.uiPosition   = new Vector2(0, -30);
            editorVersion.uiSize       = new Vector2(40, 40);
            editorVersion.uiTextColor  = new Color();
            editorVersion.uiAnchorMode = UiManager.UiAnchorsMode.MiddelStretchHorizontal;
            UiManager.CreateTextObj(curPanel, editorVersion);

            // editor dev/author
            UiTextObject editorDev = new UiTextObject();

            editorDev.uiObjName    = "editorDev";
            editorDev.uiText       = "Created by Alve Larsson. [email protected]";
            editorDev.uiTextSize   = 9;
            editorDev.uiTextAlign  = TextAnchor.MiddleCenter;
            editorDev.uiPosition   = new Vector2(0, -86);
            editorDev.uiSize       = new Vector2(20, 20);
            editorDev.uiTextColor  = new Color();
            editorDev.uiAnchorMode = UiManager.UiAnchorsMode.MiddelStretchHorizontal;
            UiManager.CreateTextObj(curPanel, editorDev);

            // editor Copyright
            UiTextObject editorCopyright = new UiTextObject();

            editorCopyright.uiObjName    = "editorCopyright";
            editorCopyright.uiText       = "Copyright (C) Xnomoto Software - All Rights Reserved";
            editorCopyright.uiTextSize   = 9;
            editorCopyright.uiTextAlign  = TextAnchor.MiddleCenter;
            editorCopyright.uiPosition   = new Vector2(0, -100);
            editorCopyright.uiSize       = new Vector2(20, 20);
            editorCopyright.uiTextColor  = new Color();
            editorCopyright.uiAnchorMode = UiManager.UiAnchorsMode.MiddelStretchHorizontal;
            UiManager.CreateTextObj(curPanel, editorCopyright);

            this.transform.parent.gameObject.AddComponent <QuickUiAnimator>().PlayFadeAnim(1, 0, false, true, 8f);
        }
示例#19
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);
        }