public void OnPointerExit(PointerEventData eventData) { if (ButtonColors.dragCursor) { BerryCursor cursor = new BerryCursor(); cursor.cursorTex = Resources.Load <Texture2D>("BerrySystem/UI/cursors/drag_up"); cursor.pos = new Vector2(0, 0); cursor.cursorMode = CursorMode.Auto; UiManager.SetCursorTexture(cursor, true); } signalState(5); switchColor(2, ButtonColors.normalColor); }
public void ClickEditBtn() { UiDropDown dropDown = new UiDropDown(); dropDown.uiPosition = new Vector2(108, -64); dropDown.uiAnchorMode = UiManager.UiAnchorsMode.TopLeft; dropDown.uiObjName = "Editor-DropDown"; dropDown.dropDownOptions = new DropDownOption[2]; dropDown.dropDownOptions[0].Name = "Console"; dropDown.dropDownOptions[0].destroy = true; dropDown.dropDownOptions[0].itemPressMethod = createEditorConsole; dropDown.dropDownOptions[1].targetNewWindow = new TerminatePreview(); UiManager.CreateDropDown(this.gameObject, dropDown); }
public override void Click() { UiDropDown dropDown = new UiDropDown(); dropDown.uiPosition = new Vector2(-168.1f, -181.01f); dropDown.uiAnchorMode = UiManager.UiAnchorsMode.MiddelCenter; dropDown.uiSize = new Vector2(145, 185); dropDown.uiObjName = "DropDown"; dropDown.dropDownOptions = new DropDownOption[2]; dropDown.dropDownOptions[0].Name = "Import sprite sheet"; //dropDown.dropDownOptions[0].targetNewWindow = new NewLayer(); dropDown.dropDownOptions[1].Name = "Import texture"; UiManager.CreateDropDown(this.gameObject, dropDown); }
public void ItemSelect() { UiDropDown dropDown = new UiDropDown(); dropDown.uiPosition = new Vector2(143.7f, 53f); dropDown.uiAnchorMode = UiManager.UiAnchorsMode.MiddelCenter; dropDown.uiSize = new Vector2(200, 34); dropDown.uiObjName = "DropDown"; dropDown.dropDownOptions = new DropDownOption[3]; dropDown.dropDownOptions[0].Name = "Player"; dropDown.dropDownOptions[0].itemPressMethod = ItemSetPlayer; dropDown.dropDownOptions[1].Name = "Enemy is this AI?"; dropDown.dropDownOptions[1].itemPressMethod = ItemSetBadAI; dropDown.dropDownOptions[2].Name = "A* AI WIP"; UiManager.CreateDropDown(targetWindowRef, dropDown); }
/*------------------------------------------------ */ // Editor UI interaction functions. /*------------------------------------------------ */ public void ClickFileBtn() { UiDropDown dropDown = new UiDropDown(); dropDown.uiPosition = new Vector2(64, -64); dropDown.uiAnchorMode = UiManager.UiAnchorsMode.TopLeft; dropDown.uiObjName = "DropDown"; dropDown.dropDownOptions = new DropDownOption[7]; dropDown.dropDownOptions[0].targetNewWindow = new BMapNew(); dropDown.dropDownOptions[1].targetNewWindow = new BMapSave(); dropDown.dropDownOptions[2].targetNewWindow = new BMapSaveAs(); dropDown.dropDownOptions[3].targetNewWindow = new BMapImport(); dropDown.dropDownOptions[4].targetNewWindow = new BXCPManager(); dropDown.dropDownOptions[5].targetNewWindow = new BEditorInfoWindow(); dropDown.dropDownOptions[6].targetNewWindow = new EditorXDP(); UiManager.CreateDropDown(this.gameObject, dropDown); }
public override void ToolActivation() { UiManager.DestroyAllFocus(); BPlacerTool toolWindowType = new BPlacerTool(); toolWindowType.targetTool = this; toolWindow = WindowManager.CreateWindow(200, 100, toolWindowType, true, true); if (toolActiveSetterIcon != null) { } GlobalToolManager.globalToolManager.ToolSelectorDeactivate(); curTileSelector.tileSelectionEnabled = false; tileSize = MapDataManager.mapDataTileSize; Icon = EditorPrimer.SpawnIconRenderer; Icon.transform.position = MapDataConverter.V3ToVector3(XCPManager.currentXCP.xpcMaps[MapDataManager.mapDataXCPIndex].mapLayers[MapDataManager.mapDataCurrentLayer].layerSpawn); Icon.transform.position += new Vector3(0, 0.4f, 0); usesDrag = true; }
public void OpenMap() { UiManager.DestroyAllFocus(); MapDataManager.MapDataOpenXCPMap(selectedItem.itemTarget.index); if (ScenePrimer.curEditorPrimer != null) { if (!ScenePrimer.curEditorPrimer.editorCreated) { ScenePrimer.curEditorPrimer.PrimerInitialize(); } else { ScenePrimer.curPrimerComponent.PrimerCreateCamera(); } } else { ScenePrimer.curSceneprimer.PrimerStartEditor(); } }
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); }
public void Click() { UiDropDown dropDown = new UiDropDown(); dropDown.uiPosition = new Vector2(132.502f, -104); dropDown.uiAnchorMode = UiManager.UiAnchorsMode.TopLeft; dropDown.uiSize = new Vector2(185, 185); dropDown.uiObjName = "DropDown"; dropDown.dropDownOptions = new DropDownOption[2]; dropDown.dropDownOptions[0].Name = " Import Tile"; dropDown.dropDownOptions[0].itemPressMethod = CreateTextureImporter; //dropDown.dropDownOptions[0].skipInstanceRef = true; dropDown.dropDownOptions[1].Name = "[ WIP ] Import TileSet"; //dropDown.dropDownOptions[1].targetNewWindow = new BImporter(); dropDown.dropDownOptions[1].skipInstanceRef = true; /* * dropDown.dropDownOptions[2].Name = " Import Sprite"; * dropDown.dropDownOptions[2].targetNewWindow = new BImporter(); * dropDown.dropDownOptions[2].skipInstanceRef = true; */ UiManager.CreateDropDown(targetWindowRef, dropDown); }
public override void Click() { if (targetField.text == "") { Error.SetActive(true); } else { // Clear the passed prewive game if (ScenePrimer.curGamePrimer != null) { if (ScenePrimer.curGamePrimer.primerParrentObj != null) { GameObject.Destroy(ScenePrimer.curGamePrimer.primerParrentObj); ScenePrimer.curGamePrimer = null; } ScenePrimer.curGamePrimer = null; } UiManager.DestroyAllFocus(); MapDataManager.MapDataCreateEmptyMap(targetField.text); if (ScenePrimer.curEditorPrimer != null) { if (!ScenePrimer.curEditorPrimer.editorCreated) { ScenePrimer.curEditorPrimer.PrimerInitialize(); } else { ScenePrimer.curPrimerComponent.PrimerCreateCamera(); } } else { ScenePrimer.curSceneprimer.PrimerStartEditor(); } } }
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>(); }
// CreateWindow is the manual way of creating a window. public static GameObject CreateWindow(int sizeX, int sizeY, BerryWindow windowType, bool spearateInstace = true, bool disableExitBg = false, bool skipInstanceRef = false) { // Disable scrolling. ( UiManager destroy all focus and BerryWindow will take care of re-enabling scrolling ) if (ScenePrimer.curPrimerComponent.curZoomComp != null) { ScenePrimer.curPrimerComponent.curZoomComp.zoomingEnabled = false; ScenePrimer.curPrimerComponent.curZoomComp.mouseScroll = 0; } ScenePrimer.curPrimerComponent.disableInput = true; // Create the window object and set it's parrent to be the target focus object. GameObject newWindow = new GameObject(windowType.windowTitleName); uiFocusInstance = UiManager.CreateUiFocusObj(spearateInstace, disableExitBg, true, windowType, false, skipInstanceRef); newWindow.transform.SetParent(uiFocusInstance.transform); windowType.isSepareateFocus = spearateInstace; // Create the actual window Object windowType.WindowCreate(sizeX, sizeY, newWindow); return(newWindow); }
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); }
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); }
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); 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 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(); }
public override void WindowCreate(int sizeX, int sizeY, GameObject windowRef) { targetWindowRef = windowRef; // A realy bad way to overide. sizeX = 200; sizeY = Screen.height - 64; // Create the window panel. windowPanel.uiSize = new Vector2(sizeX, sizeY); windowPanel.uiAnchorMode = UiManager.UiAnchorsMode.MiddelLeftStretchVertical; windowPanel.uiPosition = new Vector2(Screen.width / 2 * -1 + sizeX - 68, -32); windowPanel.uiRayCast = true; GameObject panel = UiManager.CreateBackgroundObj(windowRef, windowPanel); panel.transform.parent.gameObject.AddComponent <QuickUiAnimator>().PlayFadeAnim(0, 1, false, false, 9f); // Window content... UiButtonObject editorFileMenu = new UiButtonObject(); editorFileMenu.uiObjName = "editorFileMenu"; editorFileMenu.uiAnchorMode = UiManager.UiAnchorsMode.TopLeft; editorFileMenu.uiPosition = new Vector2(100, -24); editorFileMenu.uiSize = new Vector2(185, 32); editorFileMenu.uiStaticObj = true; editorFileMenu.uiButtonBackgroundObject.uiColor = new Color32(155, 155, 155, 100); editorFileMenu.uiButtonText = new UiTextObject(); editorFileMenu.uiButtonText.uiSize = new Vector2(185, 32); editorFileMenu.uiButtonText.uiTextAlign = TextAnchor.MiddleCenter; editorFileMenu.uiButtonText.uiText = "Import Texture"; editorFileMenu.uiButtonText.uiTextColor = new Color(0, 0, 0, 1); editorFileMenu.uiButtonIcon = null; /* * editorFileMenu.uiButtonIcon = new UiBackgroundObject(); * editorFileMenu.uiButtonIcon.uiTextureRef = ScenePrimer.curEditorPrimer.editorIcons[18]; * editorFileMenu.uiButtonIcon.uiColor = new Color(0, 0, 0, 0.5f); * editorFileMenu.uiButtonIcon.uiSize = new Vector2(17, 17); * editorFileMenu.uiButtonIcon.uiPosition = new Vector2(78, 0); */ editorFileMenu.uiButtonBackgroundObject.uiRayCast = true; editorFileMenu.uiButtonBackgroundObject.uiSize = new Vector2(185, 32); editorFileMenu.uiButtonBackgroundObject.normalColor = new Color32(170, 170, 170, 70); editorFileMenu.uiButtonBackgroundObject.hoverColor = new Color32(134, 166, 255, 100); editorFileMenu.uiButtonBackgroundObject.pressedColor = new Color32(0, 150, 255, 100); UiManager.CreateButton(panel, editorFileMenu).gameObject.AddComponent <DropDownButton>().ACClick = CreateTextureImporter; 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); 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); 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); 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); }
public override void WindowCreate(int sizeX, int sizeY, GameObject windowRef) { SessionManager.CreateMapLayer("Layer " + XCPManager.currentXCP.xpcMaps[MapDataManager.mapDataXCPIndex].mapLayers.Length, false, false); SessionManager.CreateNewMapLayerObject(XCPManager.currentXCP.xpcMaps[MapDataManager.mapDataXCPIndex].mapLayers.Length - 1); UiManager.DestroyAllFocus(); }
public void GenerateViewItems() { curHNr = hNr; if (fieldView == null) { fieldView = gameObject.GetComponent <RectTransform>(); } if (fieldView.GetComponent <RectMask2D>() == null) { gameObject.AddComponent <RectMask2D>(); } if (container != null) { GameObject.Destroy(container); container = null; } container = new GameObject("container"); container.transform.parent = fieldView; containerRect = container.AddComponent <RectTransform>(); containerRect.gameObject.AddComponent <Image>().color = new Color(0, 0, 0, 0); containerRect.localPosition = new Vector2(0, 0); containerRect.anchorMin = new Vector2(0.5f, 1); containerRect.anchorMax = new Vector2(0.5f, 1); containerRect.pivot = new Vector2(0.5f, 1); containerRect.sizeDelta = new Vector2(fieldView.sizeDelta.x, 100 * items.Length / curHNr); if (scrollHandel == null) { scrollHandel = gameObject.AddComponent <ScrollRect>(); scrollHandel.horizontal = false; scrollHandel.viewport = fieldView; scrollHandel.content = containerRect; scrollHandel.scrollSensitivity = 10; } scrollHandel.content = containerRect; UiButtonObject itemBtn = new UiButtonObject(); itemBtn.uiSize = new Vector2(64, 64); itemBtn.uiButtonText = new UiTextObject(); itemBtn.uiAnchorMode = UiManager.UiAnchorsMode.TopLeft; itemBtn.uiButtonBackgroundObject = new UiInteractiveBackgroundObject(); itemBtn.uiButtonBackgroundObject.uiAnchorMode = UiManager.UiAnchorsMode.FillStretch; itemBtn.uiButtonBackgroundObject.uiSize = new Vector2(0, 12); itemBtn.uiButtonBackgroundObject.uiPosition = new Vector2(0, -8); itemBtn.uiButtonBackgroundObject.uiRayCast = true; itemBtn.uiRayCast = true; itemBtn.uiButtonIcon = new UiBackgroundObject(); itemBtn.uiButtonIcon.uiAnchorMode = UiManager.UiAnchorsMode.FillStretch; itemBtn.uiButtonIcon.uiSize = new Vector2(0, 0); itemBtn.uiPosition = new Vector2(5, -5); itemBtn.pivot = new Vector2(0, 1); itemBtn.uiButtonText.uiPosition = new Vector2(0, -30); itemBtn.uiButtonText.uiTextColor = new Color(0, 0, 0, 1); itemBtn.uiButtonText.uiTextAlign = TextAnchor.MiddleCenter; itemBtn.uiButtonText.uiTextSize = 10; int curV = 0; int curH = 0; if (items.Length != 0) { if (verticalList) { curHNr = 1; } for (int i = 0; i < items.Length; i++) { if (!items[i].hidden) { itemBtn.uiPosition = new Vector2(curH + 66 * curH + 2, curV * -1 - 77 * curV - 2); itemBtn.uiButtonText.uiText = items[i].itemDisplayText; itemBtn.uiButtonIcon.uiSize = new Vector2(-4, -4); itemBtn.uiButtonIcon.uiTextureRef = items[i].itemIcon; UiManager.CreateButton(container, itemBtn).gameObject.AddComponent <ItemPress>().itemTarget = items[i]; curH++; if (curH >= curHNr) { curH = 0; curV++; } } } } }
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); }
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); }
public override void CreateUiType(GameObject parrent) { UiManager.CreateDropDown(parrent, this); }
public override void WindowCreate(int sizeX, int sizeY, GameObject windowRef) { MapDataManager.SwitchLayer(sizeX, true); UiManager.DestroyAllFocus(); }
// 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); } }
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 = 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); }
// Move key cheking to a diffrent class. public void Update() { // This is a great way to get some extra performance! if (Input.anyKeyDown) { if (Input.GetKeyDown(KeyCode.N) && editorCreated) { if (previewMode) { previewMode = false; disableInput = false; EditorPrimer.SpawnIcon.SetActive(true); ScenePrimer.curSceneprimer.PrimerSwitchMode(ScenePrimer.PrimerStartModes.editor, false); } else { UiManager.DestroyAllFocus(); previewMode = true; disableInput = true; spriteIcon.gameObject.SetActive(false); EditorPrimer.SpawnIcon.SetActive(false); ScenePrimer.curSceneprimer.PrimerSwitchMode(ScenePrimer.PrimerStartModes.game, false); } } if (!previewMode && editorCreated && !disableInput) { if (Input.GetKeyDown(KeyCode.KeypadPlus) || Input.GetKeyDown(KeyCode.Plus)) { if (spriteMode) { UpdateLayer(curSortingLayer + 1); } else { UpdateLayer(curLayer + 1); } } if (Input.GetKeyDown(KeyCode.KeypadMinus) || Input.GetKeyDown(KeyCode.Minus)) { if (spriteMode) { UpdateLayer(curSortingLayer - 1); } else { if (curLayer != 0) { UpdateLayer(curLayer - 1); } } } if (Input.GetKeyDown(KeyCode.E)) { if (editorGridObj != null) { if (editorGridObj.activeInHierarchy) { editorGridObj.SetActive(false); } else { editorGridObj.SetActive(true); } if (worldGrid2D.activeInHierarchy) { worldGrid2D.SetActive(false); } else { worldGrid2D.SetActive(true); } curGridBtn.IconUpdate(); } } if (Input.GetKeyDown(KeyCode.F7)) { Screen.fullScreen = !Screen.fullScreen; } // re Do change. if (Input.GetKey(KeyCode.LeftControl) && Input.GetKey(KeyCode.Y)) { if (!reDoKeyDown) { reDoKeyDown = true; SystemHistory.HistoryReDo(); } } else { reDoKeyDown = false; } // LayerPanel if (Input.GetKeyDown(KeyCode.A)) { if (layerPanel == null) { usingPanel = true; UiManager.DestroyAllFocus(); layerPanel = WindowManager.CreateWindow(0, 0, new BLayerPanel(), true, false, false); } else { usingPanel = false; UiManager.DestroyAllFocus(); layerPanel = null; } } // re Do change. if (Input.GetKeyDown(KeyCode.D)) { if (spritePanel == null) { usingPanel = true; UiManager.DestroyAllFocus(); spritePanel = WindowManager.CreateWindow(0, 0, new BSpritePanel(), true, false, false); } else { usingPanel = false; UiManager.DestroyAllFocus(); layerPanel = null; } } // re Do change. if (Input.GetKeyDown(KeyCode.S)) { if (texturePanel == null) { usingPanel = true; UiManager.DestroyAllFocus(); texturePanel = WindowManager.CreateWindow(0, 0, new BTexturePanel(), true, false, false); } else { usingPanel = false; UiManager.DestroyAllFocus(); layerPanel = null; } } if (Input.GetKeyDown(KeyCode.W)) { if (entityPanel == null) { usingPanel = true; UiManager.DestroyAllFocus(); entityPanel = WindowManager.CreateWindow(0, 0, new BEntityPanel(), true, false, false); } else { usingPanel = false; UiManager.DestroyAllFocus(); layerPanel = null; } } if (Input.GetKeyDown(KeyCode.X)) { if (itemPanel == null) { usingPanel = true; UiManager.DestroyAllFocus(); itemPanel = WindowManager.CreateWindow(0, 0, new BItemPanel(), true, false, false); } else { usingPanel = false; UiManager.DestroyAllFocus(); layerPanel = null; } } // Undo change. if (Input.GetKey(KeyCode.LeftControl) && Input.GetKey(KeyCode.Z)) { if (!undoKeyDown) { undoKeyDown = true; SystemHistory.HistoryUndo(); } } else { undoKeyDown = false; } // Save map key if (Input.GetKey(KeyCode.LeftControl) && Input.GetKey(KeyCode.S)) { if (!saveKeyDown) { if (saveMapMenu == null) { if (MapDataManager.mapDataFilePath != "") { saveKeyDown = true; BerryWindow targetWindow = new BMapSave(); saveMapMenu = WindowManager.CreateWindow(300, 300, targetWindow); } } } } else { saveKeyDown = false; } // Toggel Resource View if (Input.GetKey(KeyCode.LeftControl) && Input.GetKey(KeyCode.T)) { if (!resKeyDown) { resKeyDown = true; //curResourceView.Click(); } } else { resKeyDown = false; } // Camera pos reset // TODO : Fix so that we disable the rigidbody before the teleport to origin, and update the grids pos (Unity's physics system apparently don't like sudden teleports) if (Input.GetKey(KeyCode.LeftControl) && Input.GetKey(KeyCode.R)) { if (!cameraReset) { CameraManager.CurrentRenderCamera.transform.position = new Vector3(0, 2, 0); } } else { cameraReset = false; } } } }