public override void WindowCreate(int sizeX, int sizeY, GameObject windowRef) { targetWindowRef = windowRef; // A realy bad way to overide. sizeX = 200; sizeY = Screen.height - 64; // Create the window panel. windowPanel.uiSize = new Vector2(sizeX, sizeY); windowPanel.uiAnchorMode = UiManager.UiAnchorsMode.MiddelLeftStretchVertical; windowPanel.uiPosition = new Vector2(Screen.width / 2 * -1 + sizeX - 68, -32); windowPanel.uiRayCast = true; GameObject panel = UiManager.CreateBackgroundObj(windowRef, windowPanel); panel.transform.parent.gameObject.AddComponent <QuickUiAnimator>().PlayFadeAnim(0, 1, false, false, 9f); // Window content... UiButtonObject editorFileMenu = new UiButtonObject(); editorFileMenu.uiObjName = "editorFileMenu"; editorFileMenu.uiAnchorMode = UiManager.UiAnchorsMode.TopLeft; editorFileMenu.uiPosition = new Vector2(100, -24); editorFileMenu.uiSize = new Vector2(185, 32); editorFileMenu.uiStaticObj = true; editorFileMenu.uiButtonBackgroundObject.uiColor = new Color32(155, 155, 155, 100); editorFileMenu.uiButtonText = new UiTextObject(); editorFileMenu.uiButtonText.uiSize = new Vector2(185, 32); editorFileMenu.uiButtonText.uiTextAlign = TextAnchor.MiddleCenter; editorFileMenu.uiButtonText.uiText = "Create Entity"; editorFileMenu.uiButtonText.uiTextColor = new Color(0, 0, 0, 1); editorFileMenu.uiButtonIcon = null; editorFileMenu.uiButtonBackgroundObject.uiRayCast = true; editorFileMenu.uiButtonBackgroundObject.uiSize = new Vector2(185, 32); editorFileMenu.uiButtonBackgroundObject.normalColor = new Color32(170, 170, 170, 70); editorFileMenu.uiButtonBackgroundObject.hoverColor = new Color32(134, 166, 255, 100); editorFileMenu.uiButtonBackgroundObject.pressedColor = new Color32(0, 150, 255, 100); UiManager.CreateButton(panel, editorFileMenu).gameObject.AddComponent <DropDownButton>().ACClick = CreateEntityCreator; UiItemFeild uiFileBrowser = new UiItemFeild(); uiFileBrowser.uiPosition = new Vector2(100, -24); uiFileBrowser.uiSize = new Vector2(200, -50); uiFileBrowser.uiColor = new Color32(239, 239, 239, 255); uiFileBrowser.uiAnchorMode = UiManager.UiAnchorsMode.MiddelLeftStretchVertical; newField = UiManager.CreateItemsFeild(panel, uiFileBrowser); newField.useNumberShortCut = true; GenerateMapView(); windowRef.AddComponent <QuickUiAnimator>().PlayPosAnim(new Vector2(-230, 0), new Vector2(0, 0), false, false, 1800f); }
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); 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); UiItemFeild uiFileBrowser = new UiItemFeild(); uiFileBrowser.uiPosition = new Vector2(0, -13); uiFileBrowser.uiSize = new Vector2(470, 256); uiFileBrowser.uiColor = new Color32(239, 239, 239, 255); newField = UiManager.CreateItemsFeild(windowRef, uiFileBrowser); // Window content... UiTextInputField uiMapName = new UiTextInputField(); uiMapName.uiPosition = new Vector2(0, 136); 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 = "Textrue filepath"; feildObj = UiManager.CreateTextInputField(windowRef, uiMapName); feildObj.onEndEdit.AddListener(delegate { GoTo(); }); GenerateFeild(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures)); UiButtonObject saveButton = new UiButtonObject(); saveButton.uiPosition = new Vector2(210, -165); 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 = buttonName; saveButtonObj = UiManager.CreateButton(windowRef, saveButton).gameObject; saveButtonObj.AddComponent <DropDownButton>().ACClick = Import; DropDownOption btnCan = new DropDownOption(); btnCan.targetNewWindow = new BImporter(); btnCan.destroy = true; saveButton.uiButtonText.uiText = "Cancel"; saveButton.uiPosition = new Vector2(150, -165); UiManager.CreateButton(windowRef, saveButton).gameObject.AddComponent <DropDownButton>().ACClick = WindowTerminate; // windowRef.AddComponent <QuickUiAnimator>().PlayPosAnim(new Vector2(0, 20), new Vector2(0, 0), false, false, 120f); }