public static GameObject CreateCheckBoxButton(GameObject parrent, UiCheckBoxButton newUiCheckBoxButton) { if (newUiCheckBoxButton.uiButtonBackgroundObject == null) { newUiCheckBoxButton.uiButtonBackgroundObject = new UiInteractiveBackgroundObject(); } GameObject buttonObj = CreateUiObject(parrent, newUiCheckBoxButton); GameObject buttonRef = CreateBackgroundObj(buttonObj, newUiCheckBoxButton.uiButtonBackgroundObject); UiIntractable curUiObj = buttonObj.AddComponent <UiIntractable>(); curUiObj.targetImage = buttonRef.GetComponent <Image>(); curUiObj.ButtonColors = newUiCheckBoxButton.uiButtonBackgroundObject; curUiObj.switchColor(0, newUiCheckBoxButton.uiButtonBackgroundObject.normalColor); curUiObj.isCheckBox = true; curUiObj.isCheckBoxChecked = true; curUiObj.checkBoxRef = CreateBackgroundObj(buttonObj, newUiCheckBoxButton.uiCheckMarkObject); if (newUiCheckBoxButton.uiButtonIcon != null) { buttonObj.GetComponent <UiIntractable>().targetIcon = CreateBackgroundObj(buttonObj, newUiCheckBoxButton.uiButtonIcon); } if (newUiCheckBoxButton.uiButtonText != null) { CreateTextObj(buttonObj, newUiCheckBoxButton.uiButtonText); } return(buttonObj); }
// TODO : Replace all get component calls. public static UiIntractable CreateButton(GameObject parrent, UiButtonObject newUiButtonObject, bool disableText = false) { if (newUiButtonObject == null) { newUiButtonObject = new UiButtonObject(); } if (newUiButtonObject.uiButtonBackgroundObject == null) { newUiButtonObject.uiButtonBackgroundObject = new UiInteractiveBackgroundObject(); } GameObject buttonObj = CreateUiObject(parrent, newUiButtonObject); GameObject buttonRef = CreateBackgroundObj(buttonObj, newUiButtonObject.uiButtonBackgroundObject); UiIntractable button = buttonObj.AddComponent <UiIntractable>(); button.targetImage = buttonRef.GetComponent <Image>(); button.ButtonColors = newUiButtonObject.uiButtonBackgroundObject; button.switchColor(0, newUiButtonObject.uiButtonBackgroundObject.normalColor); if (newUiButtonObject.uiButtonIcon != null) { newUiButtonObject.uiButtonBackgroundObject.uiObjName = "Icon"; buttonObj.GetComponent <UiIntractable>().targetIcon = CreateBackgroundObj(buttonObj, newUiButtonObject.uiButtonIcon); buttonObj.GetComponent <UiIntractable>().targetIcon.GetComponent <Image>().preserveAspect = true; } if (!disableText) { if (newUiButtonObject.uiButtonText != null) { newUiButtonObject.uiButtonText.uiObjName = "Text"; CreateTextObj(buttonObj, newUiButtonObject.uiButtonText); } } return(button); }
public override void AwakeActionComponent() { btnRef = this.GetComponent <UiIntractable>(); btnRef.curAC = this; curEditorObj = ScenePrimer.curPrimerComponent.GetComponent <EditorPrimer>(); curEditorObj.curGridBtn = this; curGridObjRef = curEditorObj.editorGridObj; icon = btnRef.targetIcon.GetComponent <Image>(); }
public void Awake() { if (this.GetComponent <UiIntractable>() != null) { // Connect this components logic to the button. curUiIntractable = this.GetComponent <UiIntractable>(); curUiIntractable.curAC = this; AwakeActionComponent(); } }
public override void AwakeActionComponent() { curLocAC = this.GetComponent <UiIntractable>(); curLocAC.curAC = this; if (itemTarget.startSelect) { selected = true; curLocAC.selectIntractable(selected); if (itemTarget.itemPressMethod != null) { itemTarget.itemPressMethod(itemTarget.filePath, selected, this, false, itemTarget.index); } } }
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); }
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); }
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); }
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); }
public override void WindowCreate(int sizeX, int sizeY, GameObject windowRef) { targetWindowRef = windowRef; // A realy bad way to overide. sizeX = 200; sizeY = Screen.height - 64; // Create the window panel. windowPanel.uiSize = new Vector2(sizeX, sizeY); windowPanel.uiAnchorMode = UiManager.UiAnchorsMode.MiddelLeftStretchVertical; windowPanel.uiPosition = new Vector2(Screen.width / 2 * -1 + sizeX - 68, -32); windowPanel.uiRayCast = true; GameObject panel = UiManager.CreateBackgroundObj(windowRef, windowPanel); panel.transform.parent.gameObject.AddComponent <QuickUiAnimator>().PlayFadeAnim(0, 1, false, false, 9f); // Editor File Menu UiButtonObject editorFileMenu = new UiButtonObject(); editorFileMenu.uiObjName = "editorFileMenu"; editorFileMenu.uiAnchorMode = UiManager.UiAnchorsMode.TopLeft; editorFileMenu.uiPosition = new Vector2(100, -24); editorFileMenu.uiSize = new Vector2(185, 32); editorFileMenu.uiStaticObj = true; editorFileMenu.uiButtonBackgroundObject.uiColor = new Color32(155, 155, 155, 100); editorFileMenu.uiButtonText = new UiTextObject(); editorFileMenu.uiButtonText.uiTextAlign = TextAnchor.MiddleCenter; editorFileMenu.uiButtonText.uiText = "Layers"; editorFileMenu.uiButtonText.uiTextColor = new Color(0, 0, 0, 1); editorFileMenu.uiButtonIcon = new UiBackgroundObject(); editorFileMenu.uiButtonIcon.uiTextureRef = ScenePrimer.curEditorPrimer.editorIcons[18]; editorFileMenu.uiButtonIcon.uiColor = new Color(0, 0, 0, 0.5f); editorFileMenu.uiButtonIcon.uiSize = new Vector2(17, 17); editorFileMenu.uiButtonIcon.uiPosition = new Vector2(78, 0); editorFileMenu.uiButtonBackgroundObject.uiRayCast = true; editorFileMenu.uiButtonBackgroundObject.uiSize = new Vector2(185, 32); editorFileMenu.uiButtonBackgroundObject.normalColor = new Color32(170, 170, 170, 70); editorFileMenu.uiButtonBackgroundObject.hoverColor = new Color32(134, 166, 255, 100); editorFileMenu.uiButtonBackgroundObject.pressedColor = new Color32(0, 150, 255, 100); UiManager.CreateButton(panel, editorFileMenu).gameObject.AddComponent <editorLayersButton>(); UiTextInputField uiLayerName = new UiTextInputField(); uiLayerName.uiPosition = new Vector2(100, -90); uiLayerName.uiAnchorMode = UiManager.UiAnchorsMode.TopLeft; uiLayerName.uiSize = new Vector2(185, 32); uiLayerName.uiButtonBackgroundObject.uiRayCast = true; uiLayerName.uiButtonBackgroundObject.uiSize = uiLayerName.uiSize; uiLayerName.uiButtonBackgroundObject.uiColor = new Color32(100, 100, 100, 100); uiLayerName.uiButtonBackgroundObject.normalColor = new Color32(170, 170, 170, 100); uiLayerName.uiButtonBackgroundObject.hoverColor = new Color32(134, 166, 255, 100); uiLayerName.uiButtonBackgroundObject.pressedColor = new Color32(0, 150, 255, 100); uiLayerName.uiButtonIcon.uiColor = new Color32(255, 255, 255, 110); uiLayerName.uiButtonIcon.uiSize = new Vector2(uiLayerName.uiSize.x - 2, uiLayerName.uiSize.y - 2); uiLayerName.uiButtonText = new UiTextObject(); uiLayerName.uiButtonText.uiText = XCPManager.currentXCP.xpcMaps[MapDataManager.mapDataXCPIndex].mapLayers[MapDataManager.mapDataCurrentLayer].layerName; uiLayerName.fieldName = new UiTextObject(); uiLayerName.fieldName.uiTextColor = new Color32(0, 0, 0, 255); uiLayerName.fieldName.uiTextAlign = TextAnchor.UpperLeft; uiLayerName.fieldName.uiSize = uiLayerName.uiSize; uiLayerName.fieldName.uiPosition += new Vector2(3, 25); uiLayerName.fieldName.uiText = "Layer Name"; InputField inLayerName = UiManager.CreateTextInputField(panel, uiLayerName); inLayerName.onEndEdit.AddListener(delegate { SetLayerName(inLayerName.text); }); UiTextInputField uiLayerBgColor = new UiTextInputField(); uiLayerBgColor.uiPosition = new Vector2(100, -189); uiLayerBgColor.uiAnchorMode = UiManager.UiAnchorsMode.TopLeft; uiLayerBgColor.uiSize = new Vector2(185, 98); uiLayerBgColor.uiButtonBackgroundObject.uiRayCast = true; uiLayerBgColor.uiButtonBackgroundObject.uiSize = uiLayerBgColor.uiSize; uiLayerBgColor.uiButtonBackgroundObject.uiColor = new Color32(100, 100, 100, 100); uiLayerBgColor.uiButtonBackgroundObject.normalColor = new Color32(170, 170, 170, 100); uiLayerBgColor.uiButtonBackgroundObject.hoverColor = new Color32(134, 166, 255, 100); uiLayerBgColor.uiButtonBackgroundObject.pressedColor = new Color32(0, 150, 255, 100); uiLayerBgColor.uiButtonIcon.uiColor = new Color32(255, 255, 255, 110); uiLayerBgColor.uiButtonIcon.uiSize = new Vector2(uiLayerBgColor.uiSize.x - 2, uiLayerBgColor.uiSize.y - 2); uiLayerBgColor.fieldName = new UiTextObject(); uiLayerBgColor.fieldName.uiTextColor = new Color32(0, 0, 0, 255); uiLayerBgColor.fieldName.uiTextAlign = TextAnchor.UpperLeft; uiLayerBgColor.fieldName.uiSize = uiLayerBgColor.uiSize; uiLayerBgColor.fieldName.uiPosition += new Vector2(3, 25); uiLayerBgColor.fieldName.uiText = "Background Color"; UiManager.CreateColorInputField(panel, uiLayerBgColor, MapDataConverter.ColToColor32(XCPManager.currentXCP.xpcMaps[MapDataManager.mapDataXCPIndex].mapLayers[MapDataManager.mapDataCurrentLayer].bgColor), new RunnerLayerBGColor()); UiTextInputField uiLayerFgColor = new UiTextInputField(); uiLayerFgColor.uiPosition = new Vector2(100, -321.8f); uiLayerFgColor.uiAnchorMode = UiManager.UiAnchorsMode.TopLeft; uiLayerFgColor.uiSize = new Vector2(185, 98); uiLayerFgColor.uiButtonBackgroundObject.uiRayCast = true; uiLayerFgColor.uiButtonBackgroundObject.uiSize = uiLayerFgColor.uiSize; uiLayerFgColor.uiButtonBackgroundObject.uiColor = new Color32(100, 100, 100, 100); uiLayerFgColor.uiButtonBackgroundObject.normalColor = new Color32(170, 170, 170, 100); uiLayerFgColor.uiButtonBackgroundObject.hoverColor = new Color32(134, 166, 255, 100); uiLayerFgColor.uiButtonBackgroundObject.pressedColor = new Color32(0, 150, 255, 100); uiLayerFgColor.uiButtonIcon.uiColor = new Color32(255, 255, 255, 110); uiLayerFgColor.uiButtonIcon.uiSize = new Vector2(uiLayerFgColor.uiSize.x - 2, uiLayerFgColor.uiSize.y - 2); uiLayerFgColor.fieldName = new UiTextObject(); uiLayerFgColor.fieldName.uiTextColor = new Color32(0, 0, 0, 255); uiLayerFgColor.fieldName.uiTextAlign = TextAnchor.UpperLeft; uiLayerFgColor.fieldName.uiSize = uiLayerFgColor.uiSize; uiLayerFgColor.fieldName.uiPosition += new Vector2(3, 25); uiLayerFgColor.fieldName.uiText = "Forground Color"; UiManager.CreateColorInputField(panel, uiLayerFgColor, MapDataConverter.ColToColor32(XCPManager.currentXCP.xpcMaps[MapDataManager.mapDataXCPIndex].mapLayers[MapDataManager.mapDataCurrentLayer].forColor), new RunnerLayerFGColor()); UiButtonObject uiLayerPlayerSpawn = new UiButtonObject(); uiLayerPlayerSpawn.uiPosition = new Vector2(100, -398.27f); uiLayerPlayerSpawn.uiAnchorMode = UiManager.UiAnchorsMode.TopLeft; uiLayerPlayerSpawn.uiSize = new Vector2(185, 32); uiLayerPlayerSpawn.uiButtonBackgroundObject.uiRayCast = true; uiLayerPlayerSpawn.uiButtonBackgroundObject.uiSize = uiLayerPlayerSpawn.uiSize; uiLayerPlayerSpawn.uiButtonBackgroundObject.uiColor = new Color32(100, 100, 100, 100); uiLayerPlayerSpawn.uiButtonBackgroundObject.normalColor = new Color32(170, 170, 170, 100); uiLayerPlayerSpawn.uiButtonBackgroundObject.hoverColor = new Color32(134, 166, 255, 100); uiLayerPlayerSpawn.uiButtonBackgroundObject.pressedColor = new Color32(0, 150, 255, 100); uiLayerPlayerSpawn.uiButtonIcon.uiColor = new Color32(255, 255, 255, 110); uiLayerPlayerSpawn.uiButtonIcon.uiSize = new Vector2(uiLayerPlayerSpawn.uiSize.x - 2, uiLayerPlayerSpawn.uiSize.y - 2); uiLayerPlayerSpawn.uiButtonText = new UiTextObject(); uiLayerPlayerSpawn.uiButtonText.uiTextAlign = TextAnchor.MiddleCenter; uiLayerPlayerSpawn.uiButtonText.uiText = "Set player spawn point"; uiLayerPlayerSpawn.uiButtonText.uiTextColor = new Color(0, 0, 0, 1); uiLayerPlayerSpawn.uiButtonText.uiSize = new Vector2(185, 32); EditorToolIndicator setSpawn = UiManager.CreateButton(panel, uiLayerPlayerSpawn).gameObject.AddComponent <EditorToolIndicator>(); EditorToolPosition tool = new EditorToolPosition(); tool.toolActiveSetterIcon = Resources.Load <Sprite>("BerrySystem/Textures/Topdown/alphaSpawn"); setSpawn.targetTool = tool; uiLayerPlayerSpawn.uiPosition = new Vector2(100, -434.1f); uiLayerPlayerSpawn.uiButtonText.uiText = "Main Layer : " + XCPManager.currentXCP.xpcMaps[MapDataManager.mapDataXCPIndex].mapLayers[MapDataManager.mapDataCurrentLayer].mainLayer; if (XCPManager.currentXCP.xpcMaps[MapDataManager.mapDataXCPIndex].mapLayers[MapDataManager.mapDataCurrentLayer].mainLayer) { UiManager.CreateButton(panel, uiLayerPlayerSpawn); } else { UiIntractable setToMain = UiManager.CreateButton(panel, uiLayerPlayerSpawn).GetComponent <UiIntractable>(); setToMain.onMouseClickEvent = SetLayerMain; } windowRef.AddComponent <QuickUiAnimator>().PlayPosAnim(new Vector2(-230, 0), new Vector2(0, 0), false, false, 1800f); }
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); }
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); }