void Start() { this.control = GetComponent<dfButton>(); this.size = new dfAnimatedVector2( control.Size, control.Size, 0.33f ); this.control.Text = "#" + ( control.ZOrder + 1 ); }
void Start() { this.control = GetComponent <dfButton>(); this.size = new dfAnimatedVector2(control.Size, control.Size, 0.33f); this.control.Text = "#" + (control.ZOrder + 1); }
private void selectTabByIndex(int value) { value = Mathf.Max(Mathf.Min(value, this.controls.Count - 1), -1); if (value == this.selectedIndex) { return; } this.selectedIndex = value; for (int i = 0; i < this.controls.Count; i++) { dfButton item = this.controls[i] as dfButton; if (item != null) { if (i != value) { item.State = dfButton.ButtonState.Default; } else { item.State = dfButton.ButtonState.Focus; } } } this.Invalidate(); this.OnSelectedIndexChanged(); if (this.pageContainer != null) { this.pageContainer.SelectedIndex = value; } }
public void AddBuilding(BuildingInfo bi) { if (bi.type == 0) { dfButton button = (dfButton)Instantiate(prefabBuildingButton); dfButton helpButton = (dfButton)Instantiate(prefabHelpButton); button.Text = bi.ButtonText(); BuildingInfoContainer container = button.GetComponent <BuildingInfoContainer>(); container.bi = bi; buildingBackButton.ZOrder = 0; button.ZOrder = -1; buildButtonPanel.AddControl(button); button.AddControl(helpButton); HelpButton helpScript = helpButton.GetComponent <HelpButton>(); helpScript.bi = bi; helpButton.RelativePosition = new Vector3(button.Width - helpButton.Width - 8, button.Height - helpButton.Height - 2, 0); helpButton.BringToFront(); } }
private void SelectButton(dfButton control, string gameMode) { //foreach (var button in mainButtons) { // button.BackgroundSprite = button.BackgroundSprite.Replace("Highlight", String.Empty); //} //control.BackgroundSprite = control.BackgroundSprite + "Highlight"; foreach (var button in mainButtons) { button.GetComponents <dfTweenVector3>().Single(t => t.TweenName == "TweenSelect").EndValue = new Vector3(-470, button.Position.y); } control.GetComponents <dfTweenVector3>().Single(t => t.TweenName == "TweenSelect").EndValue = new Vector3(-400, control.Position.y); foreach (var button in mainButtons) { button.GetComponents <dfTweenVector3>().Single(t => t.TweenName == "TweenSelect").Play(); } currentlySelectedMode = control; if (gameMode != "TutorialMode") { leaderboard.OnModeSelected(gameMode); } }
// Called by Unity just before any of the Update methods is called the first time. public void Start() { // Obtain a reference to the dfButton instance attached to this object this._button = GetComponent<dfButton>(); gui = GameObject.Find("UI Root").GetComponent<GUIController>(); }
public void StartResizing(ResizableCorner pFixedCorner) { mFixedCorner = pFixedCorner; if (mFixedCorner.uButton.Position.x < mFixedCorner.uOppositeCorner.uButton.Position.x) { // We're left if (mFixedCorner.uButton.Position.y > mFixedCorner.uOppositeCorner.uButton.Position.y) { // Top Left mSprite.Pivot = dfPivotPoint.TopLeft; } else { // Bottom Left mSprite.Pivot = dfPivotPoint.BottomLeft; } } else { // We're right if (mFixedCorner.uButton.Position.y > mFixedCorner.uOppositeCorner.uButton.Position.y) { // Top Right mSprite.Pivot = dfPivotPoint.TopRight; } else { // Bottom Right mSprite.Pivot = dfPivotPoint.BottomRight; } } mFixedCornerButton = pFixedCorner.gameObject.GetComponent<dfButton>(); mIsDragging = true; }
// Use this for initialization void Start() { this._panel = GetComponent <dfPanel>(); this._indicator = Indicator; try { this._removeButton = transform.Find("Remove").GetComponent <dfButton>(); if (RemoveRemove) { this._removeButton.Hide(); } _removeButton.Click += RemoveButton_Click; } catch (Exception) { } try { this._indicator = transform.Find("Indicator").GetComponent <dfSprite>(); } catch (Exception) { } this._label = transform.Find("Label").GetComponent <dfLabel>(); this.name = gameObject.name; color = _panel.BackgroundColor; _panel.BackgroundColor = grey; // print("Init"); StartCoroutine(Initialize()); }
void TrainButton_Click(dfControl control, dfMouseEventArgs mouseEvent) { dfButton but = control as dfButton; if (EARunning) { Optimizer.StopEA(); but.Text = "Stopping"; but.TextColor = new Color32(245, 171, 0, 255); but.FocusTextColor = new Color32(245, 171, 0, 255); but.HoverTextColor = new Color32(245, 171, 0, 255); but.PressedTextColor = new Color32(245, 171, 0, 255); } else { Optimizer.StartEA(); but.Text = "Stop"; but.TextColor = new Color32(205, 0, 0, 255); but.FocusTextColor = new Color32(205, 0, 0, 255); but.HoverTextColor = new Color32(255, 0, 0, 255); but.PressedTextColor = new Color32(255, 0, 0, 255); EARunning = true; startTime = DateTime.Now.Ticks / (TimeSpan.TicksPerMillisecond * 1000); Time = 0; RunBestButton.Disable(); } }
void GenerateList(string filter) { var children = new List <GameObject>(); foreach (Transform child in PlayerPanel.transform) { children.Add(child.gameObject); } children.ForEach(child => Destroy(child)); PlayerPanel.Enable(); IEnumerable <Player> filtered = users.Where(t => t.Username.ToLower().Contains(filter.ToLower())) .OrderByDescending(t => pinnedPlayers.Any(u => u.ObjectId.Equals(t.ObjectId))).ThenBy(t => t.Username); foreach (Player player in filtered) { // GameObject ListItem = Instantiate(Resources.Load("List Item")) as GameObject; dfPanel listItem = PlayerPanel.AddPrefab(ListItem) as dfPanel; // as UserListItem; listItem.Width = PlayerPanel.Width - PlayerPanel.FlowPadding.left - PlayerPanel.FlowPadding.right; listItem.Click += new MouseEventHandler(listItem_Click); ListItemExtras extras = listItem.GetComponent <ListItemExtras>(); extras.Player = player; dfLabel username = listItem.Find("Username Label").GetComponent <dfLabel>(); username.Text = player.Username; username.DisabledColor = new Color32(100, 100, 100, 255); dfSprite onlineSprite = listItem.Find("Online Sprite").GetComponent <dfSprite>(); if (player.IsOnline) { onlineSprite.SpriteName = "OUYA_O 24px"; } else { onlineSprite.SpriteName = "OUYA_A 24px"; } dfButton actionButton = listItem.Find("Action Button").GetComponent <dfButton>(); bool f = pinnedPlayers.Any(t => t.ObjectId.Equals(player.ObjectId)); if (f) { actionButton.Text = "Unpin"; // listItem.BackgroundColor = new Color32(200, 255, 200, 255); listItem.BackgroundColor = new Color32(255, 255, 255, 255); actionButton.Click += new MouseEventHandler(actionButtonUnpin_Click); } else { actionButton.Text = "Pin"; actionButton.Click += new MouseEventHandler(actionButtonPin_Click); } } }
void MissionClick(dfControl control, dfMouseEventArgs mouseEvent, int mission) { PlayerPrefs.SetInt(CURRENT_MISSION, mission); DetailPanel.DisplayMission(mission, ((dfButton)control).Text); dfButton but = control as dfButton; SelectedSprite.RelativePosition = new Vector2(SelectedSprite.RelativePosition.x, but.RelativePosition.y + (but.Height - SelectedSprite.Height) / 2); }
// Use this for initialization void Start() { button = this.GetComponent<dfButton>(); if(visitCount >= 1) { button.Text = "Restart Scenario"; } else { button.Text = "Next Scenario"; } }
// Use this for initialization void Start() { _label = transform.Find("Label").GetComponent <dfLabel>(); _button = transform.Find("Button").GetComponent <dfButton>(); _panel = GetComponent <dfPanel>(); _panel.Hide(); _button.Click += button_Click; }
// Use this for initialization void Start() { if(button == null) { button = this.GetComponent<dfButton>(); } if(PlayerPrefs.HasKey("muteAudio")) { muted = PlayerPrefs.GetInt("muteAudio"); } SetMute(); }
private void showSelectedTab() { if (this.selectedIndex >= 0 && this.selectedIndex <= this.controls.Count - 1) { dfButton item = this.controls[this.selectedIndex] as dfButton; if (item != null && !item.ContainsMouse) { item.State = dfButton.ButtonState.Focus; } } }
public void Setup(int iPages, int iCurrentPage) { if (this.pageCount == iPages && this.pageCurrent == iCurrentPage) { return; } this.pageCount = iPages; this.pageCurrent = iCurrentPage; dfControl[] componentsInChildren = base.gameObject.GetComponentsInChildren <dfControl>(); for (int i = 0; i < (int)componentsInChildren.Length; i++) { dfControl _dfControl = componentsInChildren[i]; if (_dfControl.gameObject != base.gameObject) { UnityEngine.Object.Destroy(_dfControl.gameObject); } } if (this.pageCount <= 1) { return; } dfControl component = base.GetComponent <dfControl>(); bool flag = true; Vector3 vector3 = new Vector3(0f, 0f, 0f); for (int j = 0; j < this.pageCount; j++) { if (this.buttonGroups - j > 0 || j >= this.pageCount - this.buttonGroups || Math.Abs(j - this.pageCurrent) <= this.buttonGroups / 2) { dfButton str = ((GameObject)UnityEngine.Object.Instantiate(this.clickableButton)).GetComponent <dfButton>(); component.AddControl(str); str.Tooltip = j.ToString(); str.MouseDown += new MouseEventHandler(this.OnButtonClicked); str.Text = (j + 1).ToString(); str.Invalidate(); if (j == this.pageCurrent) { str.Disable(); } str.Position = vector3; vector3.x = vector3.x + (str.Width + 5f); flag = true; } else { if (flag) { this.DropSpacer(ref vector3); } flag = false; } } component.Width = vector3.x; }
private void Awake() { cb = this; button = GetComponent<dfButton>(); control = GetComponent<dfControl>(); tabcontainer = MenuTabContainer.tab; shipSelect = FindObjectOfType<dfCoverflow>(); title.Display("Create Captain"); hbs = FindObjectOfType<HullBarScript>(); sbs = FindObjectOfType<ShieldBarScript>(); }
public void Setup(int iPages, int iCurrentPage) { if ((this.pageCount != iPages) || (this.pageCurrent != iCurrentPage)) { this.pageCount = iPages; this.pageCurrent = iCurrentPage; foreach (dfControl control in base.gameObject.GetComponentsInChildren <dfControl>()) { if (control.gameObject != base.gameObject) { Object.Destroy(control.gameObject); } } if (this.pageCount > 1) { dfControl component = base.GetComponent <dfControl>(); bool flag = true; Vector3 vPos = new Vector3(0f, 0f, 0f); for (int i = 0; i < this.pageCount; i++) { if ((((this.buttonGroups - i) <= 0) && (i < (this.pageCount - this.buttonGroups))) && (Math.Abs((int)(i - this.pageCurrent)) > (this.buttonGroups / 2))) { if (flag) { this.DropSpacer(ref vPos); } flag = false; } else { dfButton child = ((GameObject)Object.Instantiate(this.clickableButton)).GetComponent <dfButton>(); component.AddControl(child); child.Tooltip = i.ToString(); child.MouseDown += new MouseEventHandler(this.OnButtonClicked); child.Text = (i + 1).ToString(); child.Invalidate(); if (i == this.pageCurrent) { child.Disable(); } child.Position = vPos; vPos.x += child.Width + 5f; flag = true; } } component.Width = vPos.x; } } }
private void Awake() { orig_Awake(); TabModTheGungeonSelector = Instantiate(TabGameplaySelector); TabModTheGungeonSelector.Text = "MODS"; m_panel.AddControl(TabModTheGungeonSelector); TabModTheGungeonSelector.Position = new Vector3(TabModTheGungeonSelector.Position.x, TabGameplaySelector.Position.y - 42.75f, 0); TabControlsSelector.Position = new Vector3(TabControlsSelector.Position.x, TabModTheGungeonSelector.Position.y - 42.75f, 0); TabVideoSelector.Position = new Vector3(TabVideoSelector.Position.x, TabControlsSelector.Position.y - 42.75f, 0); TabAudioSelector.Position = new Vector3(TabAudioSelector.Position.x, TabVideoSelector.Position.y - 42.75f, 0); TabModTheGungeonSelector.Click += delegate(dfControl control, dfMouseEventArgs mouseEvent) { ToggleToPanel(((FullOptionsMenuController)FullOptionsMenu).TabModTheGungeon, false, false); }; }
void Awake() { uButton = GetComponent <dfButton>(); mResizableProp = gameObject.transform.parent.parent.GetComponent <ResizableProp>(); // dfButton myButton = gameObject.GetComponent<dfButton>(); // // Figure out which corner we are // foreach(ResizableCorner c in gameObject.transform.parent.GetComponentsInChildren<ResizableCorner>()) { // dfButton d = c.gameObject.GetComponent<dfButton>(); // if (d.Position.x != myButton.Position.x && d.Position.y != myButton.Position.y) { // // This is the opposite corner // uOppositeCorner = c; // break; // } // } }
void Awake() { uButton = GetComponent<dfButton>(); mResizableProp = gameObject.transform.parent.parent.GetComponent<ResizableProp>(); // dfButton myButton = gameObject.GetComponent<dfButton>(); // // Figure out which corner we are // foreach(ResizableCorner c in gameObject.transform.parent.GetComponentsInChildren<ResizableCorner>()) { // dfButton d = c.gameObject.GetComponent<dfButton>(); // if (d.Position.x != myButton.Position.x && d.Position.y != myButton.Position.y) { // // This is the opposite corner // uOppositeCorner = c; // break; // } // } }
public void AddResearch(Research r) { if (state == null) { state = GameState.Instance; } dfButton button = (dfButton)Instantiate(prefabResearchButton); ResearchContainer container = button.GetComponent <ResearchContainer>(); container.r = r; container.state = state; button.Text = r.ButtonText(state.population, state.iq); button.ZOrder = -1; researchBackButton.ZOrder = 0; researchButtonPanel.AddControl(button); }
void Awake() { smb1 = stationMenuButton1.GetComponent <dfButton>(); smb2 = stationMenuButton2.GetComponent <dfButton>(); smb3 = stationMenuButton3.GetComponent <dfButton>(); smb4 = stationMenuButton4.GetComponent <dfButton>(); smb5 = stationMenuButton5.GetComponent <dfButton>(); smb1.Click += StationMenuButton1_Click; smb2.Click += StationMenuButton2_Click; smb3.Click += StationMenuButton3_Click; smb4.Click += StationMenuButton4_Click; smb5.Click += StationMenuButton5_Click; GameObject uic = GameObject.Find("UIController"); uim = uic.GetComponent <UIManager>(); }
void Awake() { smb1 = stationMenuButton1.GetComponent<dfButton>(); smb2 = stationMenuButton2.GetComponent<dfButton>(); smb3 = stationMenuButton3.GetComponent<dfButton>(); smb4 = stationMenuButton4.GetComponent<dfButton>(); smb5 = stationMenuButton5.GetComponent<dfButton>(); smb1.Click += StationMenuButton1_Click; smb2.Click += StationMenuButton2_Click; smb3.Click += StationMenuButton3_Click; smb4.Click += StationMenuButton4_Click; smb5.Click += StationMenuButton5_Click; GameObject uic = GameObject.Find("UIController"); uim = uic.GetComponent<UIManager>(); }
public dfControl AddTab(string Text = "") { dfButton _dfButton = this.controls.Where((dfControl i) => i is dfButton).FirstOrDefault() as dfButton; string str = string.Concat("Tab ", this.controls.Count + 1); if (string.IsNullOrEmpty(Text)) { Text = str; } dfButton atlas = base.AddControl <dfButton>(); atlas.name = str; atlas.Atlas = this.Atlas; atlas.Text = Text; atlas.ButtonGroup = this; if (_dfButton != null) { atlas.Atlas = _dfButton.Atlas; atlas.Font = _dfButton.Font; atlas.AutoSize = _dfButton.AutoSize; atlas.Size = _dfButton.Size; atlas.BackgroundSprite = _dfButton.BackgroundSprite; atlas.DisabledSprite = _dfButton.DisabledSprite; atlas.FocusSprite = _dfButton.FocusSprite; atlas.HoverSprite = _dfButton.HoverSprite; atlas.PressedSprite = _dfButton.PressedSprite; atlas.Shadow = _dfButton.Shadow; atlas.ShadowColor = _dfButton.ShadowColor; atlas.ShadowOffset = _dfButton.ShadowOffset; atlas.TextColor = _dfButton.TextColor; atlas.TextAlignment = _dfButton.TextAlignment; RectOffset padding = _dfButton.Padding; atlas.Padding = new RectOffset(padding.left, padding.right, padding.top, padding.bottom); } if (this.pageContainer != null) { this.pageContainer.AddTabPage(); } this.arrangeTabs(); this.Invalidate(); return(atlas); }
protected internal override void OnClick(dfMouseEventArgs args) { if (this.@group != null) { dfButton[] componentsInChildren = base.transform.parent.GetComponentsInChildren <dfButton>(); for (int i = 0; i < (int)componentsInChildren.Length; i++) { dfButton _dfButton = componentsInChildren[i]; if (_dfButton != this && _dfButton.ButtonGroup == this.ButtonGroup && _dfButton != this) { _dfButton.State = dfButton.ButtonState.Default; } } if (!base.transform.IsChildOf([email protected])) { base.Signal([email protected], "OnClick", new object[] { args }); } } base.OnClick(args); }
private void SelectMode(dfButton control, string gameMode) { control.IsInteractive = false; var dfTween = control.GetComponents <dfTweenVector3>().Single(t => t.TweenName == "TweenIn"); var endValue = dfTween.EndValue; dfTween.EndValue = dfTween.StartValue; dfTween.StartValue = endValue; dfTween.Play(); CameraFade.StartAlphaFade(Color.white, false, 1.8f, 0f, () => { GlobalData.Instance.GameMode = gameMode; if (gameMode != "PeriodicMode") { Application.LoadLevel("GameScene"); } else { Application.LoadLevel("LoadingScene"); } }); }
void Start() { if (Utility.IsWeb()) { dfButton saveButton = GameObject.Find("SaveButton").GetComponent <dfButton> (); saveButton.Hide(); dfTextbox saveText = GameObject.Find("NameTextbox").GetComponent <dfTextbox> (); saveText.Hide(); } planet = GameObject.Find("Planet"); mp = planet.GetComponent <Planet> (); skyboxes = Utility.GetSkyboxes(); dfDropdown skyboxDropdown = GameObject.Find("SkyBoxDropdown").GetComponent <dfDropdown> (); skyboxDropdown.Items = skyboxes; skyboxDropdown.SelectedIndex = 0; planetNormals = Utility.GetPlanetNormals(); dfDropdown normalDropdown = GameObject.Find("NormalDropdown").GetComponent <dfDropdown> (); normalDropdown.Items = planetNormals; normalDropdown.SelectedIndex = 0; dfDropdown loadDropdown = GameObject.Find("LoadDropdown").GetComponent <dfDropdown> (); if (!Utility.IsWeb()) { userPlanets = Utility.GetAllFilesInFolder("config", "userplanet"); loadDropdown.Items = userPlanets; } else { loadDropdown.Hide(); } RedrawPlanet(); }
public void StartResizing(ResizableCorner pFixedCorner) { mFixedCorner = pFixedCorner; if (mFixedCorner.uButton.Position.x < mFixedCorner.uOppositeCorner.uButton.Position.x) { // We're left if (mFixedCorner.uButton.Position.y > mFixedCorner.uOppositeCorner.uButton.Position.y) { // Top Left mSprite.Pivot = dfPivotPoint.TopLeft; } else { // Bottom Left mSprite.Pivot = dfPivotPoint.BottomLeft; } } else { // We're right if (mFixedCorner.uButton.Position.y > mFixedCorner.uOppositeCorner.uButton.Position.y) { // Top Right mSprite.Pivot = dfPivotPoint.TopRight; } else { // Bottom Right mSprite.Pivot = dfPivotPoint.BottomRight; } } mFixedCornerButton = pFixedCorner.gameObject.GetComponent <dfButton>(); mIsDragging = true; }
void GenerateList(string filter) { //Player current = Player.CurrentUser as Player; //current.Get<string>("email"); //IList<Player> players = null; //try //{ // players = current.Get<IList<Player>>("pinnedPlayers"); //} //catch (Exception e) //{ //} //if (players == null) //{ // print("players is null"); // players = new List<Player>() { users.LastOrDefault() }; //} //print("count " + players.Count); //players.Add(users.FirstOrDefault()); //current["pinnedPlayers"] = players; //current.SaveAsync(); //current.PinnedPlayers.FetchAllAsync().ContinueWith(t => //{ // if (current.PinnedPlayers != null) // { // foreach (Player p in current.PinnedPlayers) // { // print("Player: " + p.Username); // } // } // current.PinnedPlayers.Add(users.LastOrDefault()); // current.SaveAsync(); // print("Saving pinnedPlayers"); //}); var children = new List <GameObject>(); foreach (Transform child in UserPanel.transform) { children.Add(child.gameObject); } children.ForEach(child => Destroy(child)); UserPanel.Enable(); IEnumerable <Player> filtered = users.Where(t => t.Username.ToLower().Contains(filter.ToLower())).OrderByDescending(t => t.ObjectId.Equals(Player.CurrentUser.ObjectId)) .ThenByDescending(t => friendList.Contains(t.ObjectId)); foreach (Player player in filtered) { ParseObject friend = null; if (friends != null) { friend = friends.Where(t => ((Player)t[REQUEST_FROM]).ObjectId.Equals(player.ObjectId) || ((Player)t[REQUEST_TO]).ObjectId.Equals(player.ObjectId)).FirstOrDefault(); // friend = friends.FirstOrDefault(); // print("Friend: " + ((Player)friend[REQUEST_TO]).ObjectId); // print("Player: " + player.ObjectId); } // GameObject ListItem = Instantiate(Resources.Load("List Item")) as GameObject; dfPanel listItem = UserPanel.AddPrefab(ListItem) as dfPanel; // as UserListItem; listItem.Width = UserPanel.Width - UserPanel.FlowPadding.left - UserPanel.FlowPadding.right; ListItemExtras extras = listItem.GetComponent <ListItemExtras>(); extras.Player = player; extras.FriendRequest = friend; dfLabel username = listItem.Find("Username Label").GetComponent <dfLabel>(); username.Text = player.Username; username.DisabledColor = new Color32(100, 100, 100, 255); dfLabel email = listItem.Find("Email label").GetComponent <dfLabel>(); email.Text = player.Email; email.DisabledColor = new Color32(100, 100, 100, 255); dfSprite onlineSprite = listItem.Find("Online Sprite").GetComponent <dfSprite>(); if (player.IsOnline) { onlineSprite.SpriteName = "OUYA_O 24px"; } else { onlineSprite.SpriteName = "OUYA_A 24px"; } dfButton actionButton = listItem.Find("Action Button").GetComponent <dfButton>(); if (friend == null) { actionButton.Text = "Add"; actionButton.Click += new MouseEventHandler(actionClick_add); } else { string status = friend[STATUS] as string; Player from = friend[REQUEST_FROM] as Player; if (Player.CurrentUser.ObjectId.Equals(from.ObjectId)) { switch (status) { case S_ACCEPTED: actionButton.Text = "Remove"; actionButton.Click += new MouseEventHandler(actionClick_remove); listItem.BackgroundColor = new Color32(200, 255, 200, 255); break; case S_REJECTED: actionButton.Text = "Sorry"; break; case S_PENDING: actionButton.Text = "Pending"; actionButton.Disable(); break; } } else { switch (status) { case S_ACCEPTED: actionButton.Text = "Remove"; actionButton.Click += new MouseEventHandler(actionClick_remove); listItem.BackgroundColor = new Color32(200, 255, 200, 255); break; case S_REJECTED: actionButton.Text = "Rejected"; break; case S_PENDING: actionButton.Text = "Accept"; actionButton.Click += new MouseEventHandler(actionClick_accept); break; } } } if (player.Username.Equals(Player.CurrentUser.Username)) { actionButton.Hide(); } } }
// Use this for initialization void Start() { this.weaponButton = this.GetComponent <dfButton>(); weaponButton.Click += new MouseEventHandler(weaponButton_Click); }
private void EditTextOptions( dfButton control ) { using( dfEditorUtil.BeginGroup( "Text Appearance" ) ) { SelectFontDefinition( "Font", control.Atlas, control, "Font", true, true ); if( control.Font == null ) return; var align = (TextAlignment)EditorGUILayout.EnumPopup( "Text Align", control.TextAlignment ); if( align != control.TextAlignment ) { dfEditorUtil.MarkUndo( control, "Change control Text Alignment" ); control.TextAlignment = align; } var vertAlign = (dfVerticalAlignment)EditorGUILayout.EnumPopup( "Vert Align", control.VerticalAlignment ); if( vertAlign != control.VerticalAlignment ) { dfEditorUtil.MarkUndo( control, "Change Vertical Alignment" ); control.VerticalAlignment = vertAlign; } var effectiveFontSize = Mathf.CeilToInt( control.Font.FontSize * control.TextScale ); EditorGUI.BeginChangeCheck(); effectiveFontSize = EditorGUILayout.IntField( "Font Size", effectiveFontSize ); if( EditorGUI.EndChangeCheck() ) { dfEditorUtil.MarkUndo( control, "Change Font Size" ); control.TextScale = (float)effectiveFontSize / (float)control.Font.FontSize; } var scaleMode = (dfTextScaleMode)EditorGUILayout.EnumPopup( "Auto Scale", control.TextScaleMode ); if( scaleMode != control.TextScaleMode ) { dfEditorUtil.MarkUndo( control, "Change Text Scale Mode" ); control.TextScaleMode = scaleMode; } var wordwrap = EditorGUILayout.Toggle( "Word Wrap", control.WordWrap ); if( wordwrap != control.WordWrap ) { dfEditorUtil.MarkUndo( control, "Toggle Word Wrap" ); control.WordWrap = wordwrap; } var padding = dfEditorUtil.EditPadding( "Padding", control.Padding ); if( padding != control.Padding ) { dfEditorUtil.MarkUndo( control, "Change Textbox Padding" ); control.Padding = padding; } var shadow = EditorGUILayout.Toggle( "Shadow Effect", control.Shadow ); if( shadow != control.Shadow ) { dfEditorUtil.MarkUndo( control, "Change Shadow Effect" ); control.Shadow = shadow; } if( shadow ) { var shadowColor = EditorGUILayout.ColorField( "Shadow Color", control.ShadowColor ); if( shadowColor != control.ShadowColor ) { dfEditorUtil.MarkUndo( control, "Change Shadow Color" ); control.ShadowColor = shadowColor; } var shadowOffset = dfEditorUtil.EditInt2( "Shadow Offset", "X", "Y", control.ShadowOffset ); if( shadowOffset != control.ShadowOffset ) { dfEditorUtil.MarkUndo( control, "Change Shadow Color" ); control.ShadowOffset = shadowOffset; } dfEditorUtil.LabelWidth = 120f; } } using( dfEditorUtil.BeginGroup( "Text Colors" ) ) { var textColor = EditorGUILayout.ColorField( "Normal", control.TextColor ); if( textColor != control.TextColor ) { dfEditorUtil.MarkUndo( control, "Change Text Color" ); control.TextColor = textColor; } textColor = EditorGUILayout.ColorField( "Hover", control.HoverTextColor ); if( textColor != control.HoverTextColor ) { dfEditorUtil.MarkUndo( control, "Change Text Color" ); control.HoverTextColor = textColor; } textColor = EditorGUILayout.ColorField( "Pressed", control.PressedTextColor ); if( textColor != control.PressedTextColor ) { dfEditorUtil.MarkUndo( control, "Change Text Color" ); control.PressedTextColor = textColor; } textColor = EditorGUILayout.ColorField( "Focused", control.FocusTextColor ); if( textColor != control.FocusTextColor ) { dfEditorUtil.MarkUndo( control, "Change Text Color" ); control.FocusTextColor = textColor; } textColor = EditorGUILayout.ColorField( "Disabled", control.DisabledTextColor ); if( textColor != control.DisabledTextColor ) { dfEditorUtil.MarkUndo( control, "Change Text Color" ); control.DisabledTextColor = textColor; } } }
protected override void Start() { base.Start(); owner = GetComponent <dfButton>(); }
// Called by Unity just before any of the Update methods is called the first time. public void Start() { // Obtain a reference to the dfButton instance attached to this object this._button = GetComponent <dfButton>(); }
private void Awake() { button = GetComponent<dfButton>(); }
protected virtual void OnButtonStateChanged(dfButton.ButtonState value) { if (!this.isEnabled && value != dfButton.ButtonState.Disabled) { return; } this.state = value; base.Signal("OnButtonStateChanged", new object[] { value }); if (this.ButtonStateChanged != null) { this.ButtonStateChanged(this, value); } this.Invalidate(); }
private void PropertyChangedProxy( dfControl control, dfButton.ButtonState value ) { callProxyEventHandler(); }
void Awake() { testButton = this.GetComponent<dfButton>(); }
public void Start() { this._button = GetComponent <dfButton> (); }
private void EditTextOptions(dfButton control) { using (dfEditorUtil.BeginGroup("Text Appearance")) { SelectFontDefinition("Font", control.Atlas, control, "Font", true, true); if (control.Font == null) { return; } var align = (TextAlignment)EditorGUILayout.EnumPopup("Text Align", control.TextAlignment); if (align != control.TextAlignment) { dfEditorUtil.MarkUndo(control, "Change control Text Alignment"); control.TextAlignment = align; } var vertAlign = (dfVerticalAlignment)EditorGUILayout.EnumPopup("Vert Align", control.VerticalAlignment); if (vertAlign != control.VerticalAlignment) { dfEditorUtil.MarkUndo(control, "Change Vertical Alignment"); control.VerticalAlignment = vertAlign; } var effectiveFontSize = Mathf.CeilToInt(control.Font.FontSize * control.TextScale); EditorGUI.BeginChangeCheck(); effectiveFontSize = EditorGUILayout.IntField("Font Size", effectiveFontSize); if (EditorGUI.EndChangeCheck()) { dfEditorUtil.MarkUndo(control, "Change Font Size"); control.TextScale = (float)effectiveFontSize / (float)control.Font.FontSize; } var scaleMode = (dfTextScaleMode)EditorGUILayout.EnumPopup("Auto Scale", control.TextScaleMode); if (scaleMode != control.TextScaleMode) { dfEditorUtil.MarkUndo(control, "Change Text Scale Mode"); control.TextScaleMode = scaleMode; } var wordwrap = EditorGUILayout.Toggle("Word Wrap", control.WordWrap); if (wordwrap != control.WordWrap) { dfEditorUtil.MarkUndo(control, "Toggle Word Wrap"); control.WordWrap = wordwrap; } var padding = dfEditorUtil.EditPadding("Padding", control.Padding); if (padding != control.Padding) { dfEditorUtil.MarkUndo(control, "Change Textbox Padding"); control.Padding = padding; } var shadow = EditorGUILayout.Toggle("Shadow Effect", control.Shadow); if (shadow != control.Shadow) { dfEditorUtil.MarkUndo(control, "Change Shadow Effect"); control.Shadow = shadow; } if (shadow) { var shadowColor = EditorGUILayout.ColorField("Shadow Color", control.ShadowColor); if (shadowColor != control.ShadowColor) { dfEditorUtil.MarkUndo(control, "Change Shadow Color"); control.ShadowColor = shadowColor; } var shadowOffset = dfEditorUtil.EditInt2("Shadow Offset", "X", "Y", control.ShadowOffset); if (shadowOffset != control.ShadowOffset) { dfEditorUtil.MarkUndo(control, "Change Shadow Color"); control.ShadowOffset = shadowOffset; } dfEditorUtil.LabelWidth = 120f; } } using (dfEditorUtil.BeginGroup("Text Colors")) { var textColor = EditorGUILayout.ColorField("Normal", control.TextColor); if (textColor != control.TextColor) { dfEditorUtil.MarkUndo(control, "Change Text Color"); control.TextColor = textColor; } textColor = EditorGUILayout.ColorField("Hover", control.HoverTextColor); if (textColor != control.HoverTextColor) { dfEditorUtil.MarkUndo(control, "Change Text Color"); control.HoverTextColor = textColor; } textColor = EditorGUILayout.ColorField("Pressed", control.PressedTextColor); if (textColor != control.PressedTextColor) { dfEditorUtil.MarkUndo(control, "Change Text Color"); control.PressedTextColor = textColor; } textColor = EditorGUILayout.ColorField("Focused", control.FocusTextColor); if (textColor != control.FocusTextColor) { dfEditorUtil.MarkUndo(control, "Change Text Color"); control.FocusTextColor = textColor; } textColor = EditorGUILayout.ColorField("Disabled", control.DisabledTextColor); if (textColor != control.DisabledTextColor) { dfEditorUtil.MarkUndo(control, "Change Text Color"); control.DisabledTextColor = textColor; } } }