public QueueButton(int Id, int buildingId, int TeamID, int TypeID, Rect menuArea) { //Calculate rect //Need to determine button rect, margins are 1% of width float margin = menuArea.width * 0.01f; float buttonSize = (menuArea.width - (margin * 2)) / 5.0f; float buttonStartY = menuArea.yMin + margin; float buttonStartX = (menuArea.xMin + margin) + (buttonSize * Id); //Assign Rect m_ButtonRect = new Rect(buttonStartX, buttonStartY, buttonSize, buttonSize); //Assign ID's m_ID = Id; m_BuildingIdentifier = buildingId; //Create style m_ButtonStyle = GUIStyles.CreateQueueButtonStyle(); //Attach to events GUIEvents.QueueButtonChanged += ButtonPressedEvent; //Assign identifiers m_TeamIdentifier = TeamID; m_TypeIdentifier = TypeID; //Create Content Object menuArea.yMin = m_ButtonRect.yMax + 10; m_QueueContent = new QueueContent(menuArea); }
public override void OnGUI(GameObject gameObject) { this.CalculateField(); this.CalculateInsideField(); Rect outsideField = new Rect(this.field); outsideField.x -= 5; outsideField.y -= 5; outsideField.width += 5 * 2; outsideField.height += 5 * 2; GUI.Label(outsideField, new GUIContent(""), GUIStyles.GetInstance().DEFAULT_WHITE_STYLE); // SCROLL BAR scrollPosition = GUI.BeginScrollView(field, scrollPosition, insideField, false, true); // Fake the child's percieved parent's size: Rect tempField = this.field; this.field = insideField; // Children will be called! base.OnGUI(gameObject); // End the scroll view that we began above. GUI.EndScrollView(); this.field = tempField; }
private void Initialise() { //Perform all initialisation here ItemDB.Initialise(); ItemProgressTextures.Initialise(); GUIStyles.Initialise(); }
protected void Start() { currentStage = 0; transform.parent = GameObject.Find("QuestSystem").transform; transform.parent.GetComponent <QuestSystem>().questList.Add(this.gameObject); InvokeRepeating("CheckStageType", 1.5f + Time.deltaTime, 1.5f + Time.deltaTime); stylesScript = GameObject.FindGameObjectWithTag("MainCamera").transform.Find("GUIStyles").GetComponent <GUIStyles>(); }
public ProjectModuleDeletionTab(IModuniModel moduniModel, GUIStyles styles) { this.styles = styles; this.moduniModel = moduniModel; this.modulesSelector = new ModulesImportationSelector(this.CreateSelectors(this.moduniModel.ProjectModules, this.moduniModel.Modules)); this.modulesSelector.DisplayDependenciesResolvingOption = false; this.moduniModel.OnProjectModulesUpdated += this.OnProjectModulesUpdated; }
public FishExperience(FishExperience e) : base(e.GetBehavior(), e.GetOwner()) { this.SetTarget(e.GetTarget()); this.SetGameObjects(e.GetGameObjects()); this.SetTotalNumberOfFish(e.GetGameObjects().Count); s = new GUIStyle(GUIStyles.GetInstance().DEFAULT_SLIDE_STYLE); s.fontSize = (int)(s.fontSize * 0.75); }
public static GUIStyles GetInstance() { if (GUIStyles.instance == null) { GUIStyles.instance = new GUIStyles(); } return(GUIStyles.instance); }
private void OnGUI() { if (s_GUIStyles == null) { s_GUIStyles = new GUIStyles(); } DrawToolBar(); }
private void InitializeGUIStyles() { this.guiStyles = new GUIStyles(); var copyrightStyle = new GUIStyle(EditorStyles.miniLabel); copyrightStyle.alignment = TextAnchor.MiddleRight; this.guiStyles.CopyrightLabel = copyrightStyle; }
public TypeButton(ButtonType type, Rect menuArea) { m_ButtonType = type; CalculateSize(menuArea); //Create Style m_ButtonStyle = GUIStyles.CreateTypeButtonStyle(); //Attach to events GUIEvents.TypeButtonChanged += ButtonPressedEvent; }
private void Start() { StartCoroutine("FindGold"); condition = GameObject.Find("Condition"); styles = GameObject.Find("GUIStyles"); stylesScript = styles.GetComponent <GUIStyles>(); personality = GameObject.Find("Personality"); personalityScript = personality.GetComponent <Personality>(); reaction_system = GameObject.Find("ReactionSystem"); reactionScript = reaction_system.GetComponent <Reaction>(); playerInventory = GameObject.Find("Inventory"); plInventoryScript = playerInventory.GetComponent <Inventory>(); }
public override void OnGUI(GameObject gameObject) { // No need to call base // base.OnGUI (gameObject); Rect parentField = GetParentField(); float margin = parentField.width * 0.05f; for (int i = 0; i < lessons.Count; i++) { Rect cR = new Rect(margin, i * (this.buttonHeight + GUILessonList.bufferSize), parentField.width - 2 * margin, this.buttonHeight); Rect imageRect = new Rect( parentField.width - 2 * margin, i * (this.buttonHeight + GUILessonList.bufferSize) + this.buttonHeight * 0.25f, this.buttonHeight * 0.5f, this.buttonHeight * 0.5f); Texture tImage = GUIStyles.GetInstance().COMPLETED_SWATCH; Lesson lesson = lessons[i]; switch (lesson.GetCompletedness()) { case Lesson.COMPLETEDNESS.COMPLETE: tImage = GUIStyles.GetInstance().COMPLETED_SWATCH; break; case Lesson.COMPLETEDNESS.IN_PROGRESS: tImage = GUIStyles.GetInstance().IN_PROGRESS; break; default: tImage = GUIStyles.GetInstance().NOT_COMPLETED; break; } if (GUI.Button(cR, lesson.GetLessonName(), this.guiStyle)) { SoundUtil.getInstance().buttonPlay(gameObject); FlowControl.SetLesson(lesson.GetSceneName()); Application.LoadLevel("Lesson_Loader"); } // TODO show whether completed or not GUI.Label(imageRect, tImage); } }
private void OnGUI() { if (bIsVisible) { GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Width((float)Screen.width) }; GUILayout.BeginVertical(options); GUIStyles.BeginCustomSkin(_imageFiles, _settings); float consoleHeight = GetConsoleHeight(); Rect = new Rect(0f, 0f, Screen.width, consoleHeight); GUI.Window(0x1001, Rect, new GUI.WindowFunction(WindowFunc), "", GUIStyles.ConsoleWindowBackgroundStyle ); //显示预设命令行UI if (_helperOverLay.bIsVisible) { _helperOverLay.OnGUI( new Rect(0, consoleHeight, Screen.width, Screen.height - consoleHeight) ); } else if (_logModules.BIsVisible) { _logModules.OnGUI( new Rect(0, consoleHeight, Screen.width, Screen.height - consoleHeight) ); } else { } GUIStyles.EndCustomSkin(); GUILayout.EndVertical(); } }
public override void OnGUI(Rect position) { base.OnGUI(position); this.BeginArea(position) .Label("BuildSetting") .Label("", GUIStyles.Get("IN Title"), GUILayout.Height(5)) .Label("Build Target:") .Label(EditorUserBuildSettings.activeBuildTarget.ToString()) .Label("", GUIStyles.Get("IN Title"), GUILayout.Height(5)) .Label("AssetBundle OutPath:") .Label("Assets/../AssetBundles") .Label("", GUIStyles.Get("IN Title"), GUILayout.Height(5)) .Label("Manifest FilePath:") .Label(ABTool.ManifestPath) .Label("", GUIStyles.Get("IN Title"), GUILayout.Height(5)) .Space(10) .Label("LoadSetting In Editor") .Pan(() => { ABTool.ActiveBundleMode = !EditorGUILayout.Toggle(new GUIContent("AssetDataBase Load"), !ABTool.ActiveBundleMode); }) .Space(10) .Button(() => { ABBuild.DeleteBundleFile(); }, "Clear Bundle Files") .Button(() => { ABBuild.BuildManifest(ABTool.ManifestPath, ABBuiidInfo.GetAssetBundleBuilds()); }, "Build Manifest") .Button(() => { ABBuild.BuildManifest(ABTool.ManifestPath, ABBuiidInfo.GetAssetBundleBuilds()); ABBuild.BuildAssetBundles(ABBuiidInfo.GetAssetBundleBuilds(), EditorUserBuildSettings.activeBuildTarget); ProcessUtil.OpenFloder(ABTool.AssetBundlesOutputDirName); }, "Build AssetBundle") .Button(() => { ABBuild.CopyAssetBundlesTo(Application.streamingAssetsPath); }, "copy to Stream") .EndArea(); }
public void FullDraw() { GUIStyles.OnGUI(); if (!Selector) { Selector = ScriptableObject.CreateInstance <DataSelector>(); } if (EditorUtility.scriptCompilationFailed) { EditorGUILayout.HelpBox("Has compilation errors", MessageType.Error); } if (FileSystemTracker.Instance.HasChanges) { EditorGUILayout.HelpBox("Has changes on disk", MessageType.Warning); } UnityEngine.GUI.enabled = !Application.isPlaying && !EditorUtility.scriptCompilationFailed; Layout.BeginHorizontal(); Layout.Button("Save", GameState.Instance.SaveDatabase, GUILayout.Width(100)); Layout.Button("Load", GameState.Instance.ReloadDatabase, GUILayout.Width(100)); Layout.EndHorizontal(); UnityEngine.GUI.enabled = true; ScrollPosition = GUIClipStack.BeginScroll(ScrollPosition, GUIStyles.DarkGrayBackground); var gameData = GameState.Instance.GameData; if (gameData != null) { DrawFolderContent(gameData.RootFolder); } GUIClipStack.End(); }
private void InitializeGUIStyles() { this.guiStyles = new GUIStyles(); this.guiStyles.Icon = GUIStyle.none; this.guiStyles.OriginalNameLabelUnModified = EditorStyles.label; this.guiStyles.OriginalNameLabelUnModified.richText = true; this.guiStyles.OriginalNameLabelWhenModified = EditorStyles.boldLabel; this.guiStyles.OriginalNameLabelWhenModified.richText = true; this.guiStyles.NewNameLabelUnModified = EditorStyles.label; this.guiStyles.NewNameLabelUnModified.richText = true; this.guiStyles.NewNameLabelModified = EditorStyles.boldLabel; this.guiStyles.NewNameLabelModified.richText = true; this.guiStyles.FinalNameLabelUnModified = EditorStyles.label; this.guiStyles.FinalNameLabelUnModified.richText = true; this.guiStyles.FinalNameLabelWhenModified = EditorStyles.boldLabel; this.guiStyles.FinalNameLabelWhenModified.richText = true; this.guiStyles.DropPrompt = new GUIStyle(EditorStyles.label); this.guiStyles.DropPrompt.alignment = TextAnchor.MiddleCenter; this.guiStyles.DropPrompt.wordWrap = true; this.guiStyles.DropPromptRepeat = new GUIStyle(EditorStyles.label); this.guiStyles.DropPromptRepeat.alignment = TextAnchor.MiddleCenter; this.guiStyles.DropPromptHintInsideScroll = EditorStyles.centeredGreyMiniLabel; this.guiStyles.DropPromptHint = EditorStyles.wordWrappedMiniLabel; this.guiStyles.RenameSuccessPrompt = new GUIStyle(EditorStyles.label); this.guiStyles.RenameSuccessPrompt.alignment = TextAnchor.MiddleCenter; this.guiStyles.RenameSuccessPrompt.richText = true; this.guiStyles.RenameSuccessPrompt.fontSize = 16; var previewHeaderStyle = new GUIStyle(EditorStyles.toolbar); var previewHeaderMargin = new RectOffset(); previewHeaderMargin = previewHeaderStyle.margin; previewHeaderMargin.left = 1; previewHeaderMargin.right = 1; previewHeaderStyle.margin = previewHeaderMargin; this.guiStyles.PreviewHeader = previewHeaderStyle; if (EditorGUIUtility.isProSkin) { string styleName = string.Empty; #if UNITY_5 styleName = "AnimationCurveEditorBackground"; #else styleName = "CurveEditorBackground"; #endif this.guiStyles.PreviewScroll = new GUIStyle(styleName); this.guiStyles.PreviewRowBackgroundEven = new Color(0.3f, 0.3f, 0.3f, 0.2f); this.guiStyles.InsertionTextColor = new Color32(6, 214, 160, 255); this.guiStyles.DeletionTextColor = new Color32(239, 71, 111, 255); } else { this.guiStyles.PreviewScroll = EditorStyles.textArea; this.guiStyles.PreviewRowBackgroundEven = new Color(0.6f, 0.6f, 0.6f, 0.2f); this.guiStyles.InsertionTextColor = new Color32(0, 140, 104, 255); this.guiStyles.DeletionTextColor = new Color32(189, 47, 79, 255); } this.guiStyles.PreviewRowBackgroundOdd = Color.clear; }
// Start is called before the first frame update void Start() { plInventoryScript = GameObject.FindWithTag("Player").GetComponentInChildren <Inventory>(); stylesScript = GameObject.FindWithTag("MainCamera").GetComponentInChildren <GUIStyles>(); }
void OnGUI() { GUI.Box(new Rect(0, Screen.height - Screen.height * 0.05f, Screen.width, Screen.height * 0.1f), qrText, GUIStyles.QRStyle(Screen.height, Screen.width)); GUI.Box(new Rect(0, 0, Screen.width, Screen.height * 0.1f), "Scan the QR code to join the game", GUIStyles.QRStyle(Screen.height, Screen.width)); if (Input.GetKeyDown(KeyCode.Escape)) { Application.Quit(); } }
private void ABBContentWinGUI(Rect rect) { rect.DrawOutLine(2, Color.black); int lineCount = ChossedABB == null ? 0 : ChossedABB.assetNames.Count; ABBContentTable.Calc(rect, new Vector2(rect.x, rect.y + LineHeight), ABBContentScrollPos, LineHeight, lineCount, ABBContentSetting); this.Label(ABBContentTable.titleRow.position, "", TitleStyle) .Label(ABBContentTable.titleRow[AssetName].position, AssetName) .Label(ABBContentTable.titleRow[Bundle].position, Bundle) .Label(ABBContentTable.titleRow[Size].position, Size); Event e = Event.current; this.DrawScrollView(() => { for (int i = ABBContentTable.firstVisibleRow; i < ABBContentTable.lastVisibleRow + 1; i++) { ABDeprndence asset = GetDpByName(ChossedABB.assetNames[i]); GUIStyle style = i % 2 == 0 ? EntryBackEven : EntryBackodd; if (e.type == EventType.Repaint) { style.Draw(ABBContentTable.rows[i].position, false, false, ABBContentTable.rows[i].selected, false); } this.Label(ABBContentTable.rows[i][Size].position, asset.Size) .Label(ABBContentTable.rows[i][AssetName].position, asset.AssetName) .Label(ABBContentTable.rows[i][Preview].position, asset.ThumbNail) .Label(ABBContentTable.rows[i][Bundle].position, asset.BundleName) .Pan(() => { if (asset.AssetBundles.Count == 1) { this.Label(ABBContentTable.rows[i][CrossRef].position, EditorGUIUtility.IconContent("Collab")); } else { this.Label(ABBContentTable.rows[i][CrossRef].position, asset.AssetBundles.Count.ToString(), GUIStyles.Get("CN CountBadge")); } }); if (e.modifiers == EventModifiers.Control && e.button == 0 && e.clickCount == 1 && ABBContentTable.rows[i].position.Contains(Event.current.mousePosition)) { ABBContentTable.ControlSelectRow(i); window.Repaint(); } else if (e.modifiers == EventModifiers.Shift && e.button == 0 && e.clickCount == 1 && ABBContentTable.rows[i].position.Contains(e.mousePosition)) { ABBContentTable.ShiftSelectRow(i); window.Repaint(); } else if (e.button == 0 && e.clickCount == 1 && ABBContentTable.rows[i].position.Contains(e.mousePosition)) { ABBContentTable.SelectRow(i); ChoosedAsset = asset; window.Repaint(); } } }, ABBContentTable.view, ref ABBContentScrollPos, ABBContentTable.content, false, false); Handles.color = Color.black; for (int i = 0; i < ABBContentTable.titleRow.columns.Count; i++) { var item = ABBContentTable.titleRow.columns[i]; if (i != 0) { Handles.DrawAAPolyLine(1, new Vector3(item.position.x - 2, item.position.y, 0), new Vector3(item.position.x - 2, item.position.yMax - 2, 0)); } } ABBContentTable.position.DrawOutLine(2, Color.black); Handles.color = Color.white; if (e.button == 0 && e.clickCount == 1 && (ABBContentTable.view.Contains(e.mousePosition) && !ABBContentTable.content.Contains(e.mousePosition))) { ABBContentTable.SelectNone(); ChoosedAsset = null; window.Repaint(); } if (e.button == 1 && e.clickCount == 1 && ABBContentTable.content.Contains(e.mousePosition)) { GenericMenu menu = new GenericMenu(); menu.AddItem(new GUIContent("Delete"), false, () => { ABBContentTable.selectedRows.ReverseForEach((row) => { window.RemoveAsset(ChossedABB.assetNames[row.rowID], ChossedABB.assetBundleName); }); window.UpdateInfo(); ChoosedAsset = null; }); menu.ShowAsContext(); if (e.type != EventType.Layout) { e.Use(); } } }
public GUILabel(string text) { this.text = text; this.style = GUIStyles.GetInstance().DEFAULT_WHITE_STYLE; }
public GUILessonList(List <Lesson> lessons) { this.lessons = lessons; this.guiStyle = GUIStyles.GetInstance().DEFAULT_LESSON_BUTTON_STYLE; }
public GUISetup() { GUIStyle style = null; var border1 = new RectOffset(1, 1, 1, 1); var border2 = new RectOffset(2, 2, 2, 2); var texSize1 = new Rect(1, 1, 1, 1); var texSize2 = new Rect(2, 2, 1, 1); font = font != null ? font : Fonts.Get("Consolas", GUI.skin.font.fontSize); if (background == null) { background = GUIStyles.Get(GUI.skin.box, Vector2.zero, border2, 8, new Color(1f, 1f, 1f)); background.normal.background = Textures.Make(texSize2, new Color(0.3f, 0.3f, 0.3f), Color.black); } if (itemBG == null) { itemBG = new List <GUIStyle>(); float color = 0.8f; for (int i = 0; i < 5; i++) { style = GUIStyles.Get(String.Format("item_{0}_", i), GUI.skin.box, Vector2.zero, border1, 8, new Color(1f, 1f, 1f)); style.normal.background = Textures.Make(texSize1, new Color(color, color, color), Color.black); itemBG.Add(style); color -= 0.05f; } } if (titleText == null) { titleText = GUIStyles.Get("text", GUI.skin.label, Vector2.zero, border1, 18, Color.black); titleText.fontStyle = FontStyle.Bold; titleText.alignment = TextAnchor.MiddleCenter; titleText.padding = new RectOffset(); } if (itemText == null) { itemText = GUIStyles.Get("text", GUI.skin.label, Vector2.zero, border1, 10, Color.black); itemText.alignment = TextAnchor.MiddleLeft; itemText.padding = new RectOffset(); } if (actives == null) { actives = new GUIStyle[2]; actives[0] = GUIStyles.Get("active_off_", GUI.skin.box, Vector2.zero, border1, 8, new Color(1f, 1f, 1f)); actives[0].normal.background = Textures.Make(texSize1, new Color(0.1f, 0.3f, 0.1f), Color.grey); actives[1] = GUIStyles.Get("active_on__", GUI.skin.box, Vector2.zero, border1, 8, new Color(1f, 1f, 1f)); actives[1].normal.background = Textures.Make(texSize1, new Color(0.1f, 1.0f, 0.1f), Color.black); } //d.Init(new Color(194f / 255f, 0, 0).rrrn(1), 512, 512, new Rect(vec2(-10), vec2(20)), "test"); //d.Clear(); ////d.Add(new Textures.Drawer.Sphere(5) { color = Color.red, elongate = vec3(2, 0, 2) }); ////d.Add(new Textures.Drawer.Sphere(5) { color = Color.black, fallout = 2.5f, skin = 0.1f, elongate = vec3(2, 0, 2) }); //d.Add(new Textures.Drawer.Box(vec3(6, 2, 2)) { color = Color.red }); //d.Add(new Textures.Drawer.SmoothSubstraction(new Textures.Drawer.Box(vec3(6, 2, 2)), // new Textures.Drawer.Box(vec3(2, 4, 6)), // 1) //{ color = Color.cyan }); ////d.Add(new Textures.Drawer.Torus(vec2(8, 1)) { color = Color.green, fallout = 1 }); ////d.Add(new Textures.Drawer.Hexagon(vec2(3, 1)) { color = Color.magenta, fallout = 1 }); ////d.Add(new Textures.Drawer.Triangle(vec3(0), vec3(2, 0, 0), vec3(1, 0, 2)) { color = Color.cyan, fallout = 1, rounding = 1 }); //d.Make(); //var txt = EditorGUILayout.GetControlRect(GUILayout.Width(d.texture.width), GUILayout.Height(d.texture.height)); //GUI.Box(txt, d.texture); }
// Start is called before the first frame update void Start() { player = transform.parent.gameObject; stylesScript = GameObject.FindGameObjectWithTag("MainCamera").transform.Find("GUIStyles").GetComponent <GUIStyles>(); }
public static GUIStyles GetInstance() { if (GUIStyles.instance == null) { GUIStyles.instance = new GUIStyles(); } return GUIStyles.instance; }
/** * Constructor */ public GUIButton() { guiStyle = GUIStyles.GetInstance().DEFAULT_BUTTON_STYLE; clickedTexture = GUIStyles.GetInstance().DARK_ORANGE_SWATCH; }
// Start is called before the first frame update void Start() { guiStyles = GameObject.Find("GUIStyles").GetComponent <GUIStyles>(); }
void ConnectionPopUp(string errorMessage) { UnityEngine.GUI.Box(new Rect(Screen.width / 2 - width / 2, Screen.height / 2 - height / 2, width, height), errorMessage, GUIStyles.QRStyle(Screen.height, Screen.width)); if (UnityEngine.GUI.Button(new Rect(Screen.width / 2 - width / 2, Screen.height / 2 - height / 4, width, height), "Tap to return to QR scanner", GUIStyles.ButtonStyle(Screen.height - height, Screen.width - width))) { Application.LoadLevel("QRCodeScene"); } }
/** * Initialization code. * * Set up distances and origin points. */ void Start() { controller = GetComponent <CharacterController>(); // Adjust the collider size to fit a fish controller.height = colliderHeight; controller.radius = colliderRadius; model = this.GetComponent <ARModel>(); cam = Camera.main; float componentMaxDistance = maxDistance / 2; float x = Random.Range(-componentMaxDistance, componentMaxDistance); float y = Random.Range(0, componentMaxDistance * 2); float z = Random.Range(-componentMaxDistance, componentMaxDistance); Vector3 startPoint = origin + new Vector3(x, y, z); transform.Translate(startPoint); centerPoint = origin; affected = gameObject.name.Contains("affected"); // ------------------------ Set up GUI ----------------------------------- \\ // Create affected button GUIButton isAffected = new GUIButton(); isAffected.SetText("Yes"); isAffected.SetBox(new Box() .SetMarginTop("auto") .SetMarginRight(0.01f) .SetMarginLeft("auto") .SetMarginBottom(0.01f) .SetWidth(Screen.width * 0.2 + "px") .SetHeight(0.4f)); isAffected.OnClick(this.IThinkItsAffected); // Create not affected button GUIButton isNotAffected = new GUIButton(); isNotAffected.SetText("No"); isNotAffected.SetBox(new Box() .SetMarginTop("auto") .SetMarginRight("auto") .SetMarginLeft(0.01f) .SetMarginBottom(0.01f) .SetWidth(Screen.width * 0.2 + "px") .SetHeight(0.4f)); isNotAffected.OnClick(this.IThinkItsNotAffected); GUIFactory factory = new GUIFactory(); factory.CreateLabel("Has this fish been affected by oil?") .SetBox(new Box() .SetMarginBottom(0.1f) .SetMarginTop(0.6f) .SetMarginLeft(0.1f) .SetMarginRight(0.1f)) .Append(isAffected) .Append(isNotAffected); gui = factory.Build(); // -------------------- Look closely GUI Set up ----------------------------------- \\ // Create Confirm button GUIButton confirm = new GUIButton(); confirm.SetText("Okay"); confirm.SetBox(new Box() .SetMarginTop("auto") .SetMarginRight(0.01f) .SetMarginLeft("auto") .SetMarginBottom(0.01f) .SetWidth(Screen.width * 0.2 + "px") .SetHeight(0.4f)); confirm.OnClick(this.Confirm); GUIFactory lookCloselyGUIFactory = new GUIFactory(); GUIComponent gc = lookCloselyGUIFactory.CreateLabel("Look closely! Fish affected by pollution will have splotches of oil across their scales.") .SetBox(new Box() .SetMarginBottom(0.1f) .SetMarginTop(0.6f) .SetMarginLeft(0.1f) .SetMarginRight(0.1f)); GUILabel gl = (GUILabel)gc; GUIStyle gs = GUIStyles.GetInstance().DEFAULT_WHITE_STYLE; gs.wordWrap = true; gl.SetStyle(gs); gc.Append(confirm); lookCloselyGUI = lookCloselyGUIFactory.Build(); // --------------------- alreadyExaminedGUI -------------------------------------- \\ // Create Confirm button GUIButton confirmAlreadyExamined = new GUIButton(); confirmAlreadyExamined.SetText("Okay"); confirmAlreadyExamined.SetBox(new Box() .SetMarginTop("auto") .SetMarginRight(0.01f) .SetMarginLeft("auto") .SetMarginBottom(0.01f) .SetWidth(Screen.width * 0.2 + "px") .SetHeight(0.4f)); confirmAlreadyExamined.OnClick(this.ConfirmAlreadyExamined); GUIFactory alreadyExaminedGUIFactory = new GUIFactory(); alreadyExaminedGUIFactory.CreateLabel("You have already examined this fish.") .SetBox(new Box() .SetMarginBottom(0.1f) .SetMarginTop(0.6f) .SetMarginLeft(0.1f) .SetMarginRight(0.1f)) .Append(confirmAlreadyExamined); alreadyExaminedGUI = alreadyExaminedGUIFactory.Build(); }
public override void OnGUI(Rect position) { base.OnGUI(position); GUI.BeginGroup(position); Rect pos = new Rect(new Vector2(50, 10), new Vector2(400, 400)); GUI.Box(pos, ""); Handles.color = window._backgroundColor; Vector2 end = new Vector2(pos.width, pos.height) + pos.position; Handles.DrawLine(new Vector2(0, pos.height) + pos.position, end); end = new Vector2(0, pos.height) + pos.position; Handles.DrawLine(new Vector2(0, 0) + pos.position, end); float hCount = pos.width / cellsize; float vCount = pos.height / cellsize; hCount = Math.Min(hCount, vCount); Handles.DrawLine(pos.BottomLeft(), new Vector2(hCount * cellsize, pos.height - hCount * cellsize) + pos.position); int _index = 0; while (pos.height >= _index * cellsize) { float y = pos.height - _index * cellsize; Vector2 left = new Vector2(0, y) + pos.position; Vector2 right = new Vector2(pos.width, y) + pos.position; Handles.DrawLine(left, right); GUI.Label(new Rect(left + new Vector2(-20, -6), Vector2.one * 80), (_index * delta).ToString("0.0")); _index++; } _index = 0; while (pos.width >= _index * cellsize) { float x = _index * cellsize; Vector2 top = new Vector2(x, 0) + pos.position; Vector2 buttom = new Vector2(x, pos.height) + pos.position; Handles.DrawLine(top, buttom); GUI.Label(new Rect(buttom + new Vector2(-8, 0), Vector2.one * 80), (_index * delta).ToString("0.0")); _index++; } float per = 0; float _p = 0.002f; float pixels = cellsize * 1 / delta; while (per < 1) { var p1 = _converter.Convert(per / 1, per, 1); per += _p; var p2 = _converter.Convert(per / 1, per, 1); Handles.color = Color.Lerp(window._curveHeadColor, window._curveTrailColor, per); Handles.DrawLine(new Vector2((per - _p) * pixels, pos.height - p1 * pixels) + pos.position, new Vector2(per * pixels, pos.height - p2 * pixels) + pos.position); } var rect = new Rect(pos.BottomLeft() + new Vector2(0, 30), new Vector2(pos.width, 20)); var rs = rect.VerticalSplit(pos.width / 4 * 3, 20); _percent = EditorGUI.Slider(rs[0], "Percent", _percent, 0, 1); if (GUI.Button(rs[1], "Watch Curve")) { _percent = 0; if (tween != null) { tween.Complete(false); tween = null; } tween = TweenEx.DoGoto(0, 1, 5f, () => { return(_percent); }, (value) => { _percent = value; window.Repaint(); }, false, EditorEnv.envType) .SetEase(_ease) .OnCompelete(() => { _percent = 1; }) .SetDeltaTime((float)EditorEnv.env.deltaTime.TotalMilliseconds); } { var point = _converter.Convert(_percent, _percent, 1); Rect cone = new Rect(Vector2.zero, Vector2.one * 10); cone.center = new Vector2(_percent * pixels, pos.height - point * pixels) + pos.position; GUI.Box(cone, new GUIContent("", point.ToString()), GUIStyles.Get("U2D.createRect")); var content = new GUIContent(point.ToString()); var size = GUIStyles.Get("label").CalcSize(content); GUI.Label(new Rect(cone.position + Vector2.one * 10, size), content); } GUI.EndGroup(); }
private void ListView(Event e) { tableViewCalc.Calc(position, new Vector2(position.x, position.y + lineHeight), ScrollPos, lineHeight, DirCollect.DirCollectItems.Count, Setting); if (Event.current.type == EventType.Repaint) { GUIStyles.Get(EntryBackodd).Draw(tableViewCalc.position, false, false, false, false); } bool tog = true; this.Toggle(tableViewCalc.titleRow.position, ref tog, GUIStyles.Get(TitleStyle)) .LabelField(tableViewCalc.titleRow[CollectType].position, CollectType) .LabelField(tableViewCalc.titleRow[BundleName].position, BundleName) .LabelField(tableViewCalc.titleRow[SearchPath].position, SearchPath); this.DrawScrollView(() => { for (int i = tableViewCalc.firstVisibleRow; i < tableViewCalc.lastVisibleRow + 1; i++) { GUIStyle style = i % 2 == 0 ? EntryBackEven : EntryBackodd; if (e.type == EventType.Repaint) { style.Draw(tableViewCalc.rows[i].position, false, false, tableViewCalc.rows[i].selected, false); } if (e.modifiers == EventModifiers.Control && e.button == 0 && e.clickCount == 1 && tableViewCalc.rows[i].position.Contains(e.mousePosition)) { tableViewCalc.ControlSelectRow(i); window.Repaint(); } else if (e.modifiers == EventModifiers.Shift && e.button == 0 && e.clickCount == 1 && tableViewCalc.rows[i].position.Contains(e.mousePosition)) { tableViewCalc.ShiftSelectRow(i); window.Repaint(); } else if (e.button == 0 && e.clickCount == 1 && tableViewCalc.rows[i].position.Contains(e.mousePosition)) { tableViewCalc.SelectRow(i); window.Repaint(); } ABDirCollectItem item = DirCollect.DirCollectItems[i]; int index = (int)item.CollectType; this.Popup(tableViewCalc.rows[i][CollectType].position, ref index, Enum.GetNames(typeof(ABDirCollectItem.ABDirCollectType))); item.CollectType = (ABDirCollectItem.ABDirCollectType)index; this.Button(() => { chosseWindow.assetinfo = item.subAsset; PopupWindow.Show(tableViewCalc.rows[i][SelectButton].position, chosseWindow); } , tableViewCalc.rows[i][SelectButton].position, SelectButton); this.Label(tableViewCalc.rows[i][SearchPath].position, item.SearchPath); if (item.CollectType == ABDirCollectItem.ABDirCollectType.ABName) { this.TextField(tableViewCalc.rows[i][BundleName].position, ref item.BundleName); } } }, tableViewCalc.view, ref ScrollPos, tableViewCalc.content, false, false); Handles.color = Color.black; for (int i = 0; i < tableViewCalc.titleRow.columns.Count; i++) { var item = tableViewCalc.titleRow.columns[i]; if (i != 0) { Handles.DrawAAPolyLine(1, new Vector3(item.position.x - 2, item.position.y, 0), new Vector3(item.position.x - 2, item.position.yMax - 2, 0)); } } tableViewCalc.position.DrawOutLine(2, Color.black); Handles.color = Color.white; }
void OnEnable() { styles = (GUIStyles) target; }
public GUILabel() { this.text = ""; this.style = GUIStyles.GetInstance().DEFAULT_WHITE_STYLE; }