void RebuildActionList(MT_Combatant who) { if (Dbg.Assert(who != null)) { return; } if (Dbg.Assert(who.Base != null)) { return; } if (Dbg.Assert(who.Base.Actions != null)) { return; } for (int i = 0; i < who.Base.Actions.Count; i++) { GameObject obj = AddElement(); if (Dbg.Assert(obj != null)) { return; } UI_ActionListPanelEntry entry = obj.GetComponent <UI_ActionListPanelEntry>(); if (Dbg.Assert(entry != null)) { return; } entry.Set(who, who.Base.Actions[i], i); UN.SetActive(obj, true); } }
private void Window_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.F1) { About abo = new About(); abo.ShowDialog(); } else if (e.Key == Key.F11) { Kernel.Core.IsSetup = false; Set set = new Set(); set.Show(); } else if (e.Key == Key.F12) { if (Kernel.Core.IsCMode == false) { ConGui consl = new ConGui(); consl.Show(); } } if (UN.Text == "") { UN.Focus(); } }
public void HidePopup(bool hideAll) { if (hideAll) { UN.SetActive(_root, false); } }
void Refresh() { if (Dbg.Assert(_target != null)) { return; } if (_target.IsHilighted || _target.IsSelected) { Material mat = null; if (_target.IsHilighted && _target.IsSelected) { mat = _selectedAndHilightedMat; } else if (_target.IsHilighted) { mat = _highlightedMat; } else if (_target.IsSelected) { mat = _selectedMat; } if (_projector.material != mat) { _projector.material = mat; } } UN.SetActive(gameObject, _target.IsHilighted || _target.IsSelected); }
void OnScoreChanged(MT_ScoreChangedEvent ev) { // ### TODO: implement 3+ teams UN.SetText(_scoreL, PT_Game.Match.Result.GetScore(0).ToString()); UN.SetText(_scoreR, PT_Game.Match.Result.GetScore(1).ToString()); }
private void UN_Click_1(object sender, EventArgs e) { if (UN.ForeColor == Color.Gray) { UN.Clear(); UN.ForeColor = Color.Black; } }
public int ShowDestinationPoint(Vector3 position, int widgetId = -1) { Widget widget = GetWidget(widgetId, _pathDestinationPool); widget.Visual.transform.position = position; UN.SetActive(widget.Visual, true); return(widget.Id); }
public override void SetSelected(bool b) { if (b != IsSelected) { IsSelected = b; Refresh(); UN.SetActive(this, b); } }
public void EnterUsername(string un) { int trimLength = 5; if (UN.Length > trimLength) { UN = UN.Remove(trimLength); } }
private void Start() { _music = PT_Game.Sound.InstantiateSource("IntroMusic", transform); for (int i = 0; i < _spashImages.Length; i++) { UN.SetActive(_spashImages[i], false); } _introOp = StartCoroutine(ShowIntro()); }
void OnClick(bool response) { if (_info.CloseOnFinish) { UN.SetActive(_root, false); } if (_info.Callback != null) { _info.Callback(response); } }
protected override void Awake() { base.Awake(); UN.SetActive(_root, false); _defaultOkText = _okBtnText.text; _defaultCancelText = _cancelBtnText.text; _ok.onClick.RemoveAllListeners(); _ok.onClick.AddListener(() => OnClick(true)); _cancel.onClick.RemoveAllListeners(); _cancel.onClick.AddListener(() => OnClick(false)); }
protected override void OnEnable() { base.OnEnable(); UpdateButtons(); if (HasSavedGame()) { UN.SetSelected(_continueBtn); } else { UN.SetSelected(_newBtn); } Events.AddGlobalListener <LG_NewLeagueInitializationFinishedEvent>(OnNewLeagueCreationFinished); }
void SetTarget(SM_ISelectable sel) { _target = sel; if (_target != null) { _selectionProjector.transform.SetParent(_target.gameObject.transform); _selectionProjector.transform.localPosition = Vector3.zero; _selectionProjector.transform.localRotation = Quaternion.identity; Refresh(); } else { UN.SetActive(_selectionProjector, false); } }
public void Update() { MT_Combatant me = PT_Game.UI.Match.SelectedPCCombatant; bool active = me != null; UN.SetActive(_actionList, active); UN.SetActive(_apAvail, active); UN.SetActive(_apCost, active); if (active) { UN.SetText(_apAvail, ((int)Math.Round(me.Base.ActionPoints)).ToString()); UN.SetActive(_apCost, active); //### TODO: Add logic to compute cost of current action } }
public int ShowPath(List <Vector3> pathPositions, int widgetId = -1) { Widget widget = GetWidget(widgetId, _pathLinePool); Dbg.Assert(widget != null); UN_VisualLine line = widget.Visual.GetComponent <UN_VisualLine>(); if (Dbg.Assert(line != null)) { return(-1); } line.SetLine(pathPositions); UN.SetActive(line.gameObject, true); return(widget.Id); }
protected override void Start() { base.Start(); // if we're debugging arena, we might not have some things if (PT_Game.Match == null) { return; } _team = PT_Game.Match.GetTeam(_teamNdx); if (_team == null) { Dbg.LogWarning("Not team for this display"); UN.SetActive(this, false); return; } _backGround.color = _team.BaseColor; UN.SetText(_teamName, _team.DisplayName); UN.SetText(_scoreText, PT_Game.Match.GetTeamScore(_teamNdx).ToString()); List <MT_Combatant> cbts = PT_Game.Match.GetTeamCombatants(_teamNdx); int numPlayers = cbts.Count; UI_CombatantMiniDisplay thingToSet; for (int i = 0; i < numPlayers; i++) { if (i == 0) { thingToSet = _template; } else { object o = Instantiate(_template.gameObject, _playerListRoot.gameObject.transform); GameObject newThing = o as GameObject; thingToSet = newThing.GetComponent <UI_CombatantMiniDisplay>(); _combatants.Add(thingToSet); } UN.SetActive(thingToSet, true); thingToSet.SetCombatant(PT_Game.Match.GetTeamCombatants(_teamNdx)[i]); } }
public static void EnableHttps() { lock (Https_EnableOneAtATime) { Logger.Log("Enabling Https (Secure) Host on Port " + OPCBackEnd.Config.Https_Port + "..."); WCFHost_Https = new WCFHost <OPCBrowserContract, iOPCBrowserContract>(OPCBackEnd.Config.Https_Port, HostProtocolType.HTTPS, OPCBackEnd.Config.RequireAPIBasicAuthentication); if (OPCBackEnd.Config.RequireAPIBasicAuthentication) { Logger.Log("Enabling Username and Password Authentication for Https Secure Host..."); WCFHost_Https.EnableUserAuthentication = true; WCFHost_Https.OnValidatingUsernamePassword = (UN, PW) => { return(UN.ToLower() == OPCBackEnd.Config.Username_ForAPIBasicAuthentication.ToLower() && PW == OPCBackEnd.Config.Password_ForAPIBasicAuthentication); }; } WCFHost_Https.Start(); } }
public void SetCombatant(MT_Combatant c) { _who = c; if (c == null) { UN.SetActive(_visualBase, false); } else { UN.SetActive(_visualBase, true); UN.SetText(_nameText, c.Base.FullName); UN.SetFill(_healthBar, c.Base.GetPropertyRatio(BS_PropertyId.Health)); UN.SetFill(_apBar, c.Base.GetPropertyRatio(BS_PropertyId.ActionPoints)); UN.SetEnabled(_selectBtn, !c.Base.Team.IsAI); _icon.sprite = PT_Game.Data.Icons.GetIcon(c.Base.IconImageName); } }
// Use this for initialization protected override void OnEnable() { base.OnEnable(); if (PT_Game.Match.GetNumActiveTeams() == 0) // really only happens when debugging from match scene { return; } // ### TODO: implement 3+ teams BS_Team team = PT_Game.Match.GetTeam(0); UN.SetText(_teamL, team.DisplayName); //_teamL.color = team.BaseColor; //_scoreL.color = team.BaseColor; team = PT_Game.Match.GetTeam(1); UN.SetText(_teamR, team.DisplayName); //_teamR.color = team.BaseColor; //_scoreR.color = team.BaseColor; }
public static void EnableHttp() { lock (Http_EnableOneAtATime) { Logger.Log("Enabling Http Host on Port " + OPCBackEnd.Config.Http_Port + "..."); WCFHost_Http = new WCFHost <OPCBrowserContract, iOPCBrowserContract>(OPCBackEnd.Config.Http_Port, HostProtocolType.HTTP, OPCBackEnd.Config.RequireAPIBasicAuthentication); if (OPCBackEnd.Config.RequireAPIBasicAuthentication) { Logger.Log("Enabling Username and Password Authentication for Http Host..."); WCFHost_Http.EnableUserAuthentication = true; WCFHost_Http.OnValidatingUsernamePassword = (string UN, string PW, out UserBase User) => { User = null; return(UN.ToLower() == OPCBackEnd.Config.Username_ForAPIBasicAuthentication.ToLower() && PW == OPCBackEnd.Config.Password_ForAPIBasicAuthentication); }; } WCFHost_Http.Start(); } }
public void ShowPopup(PopupInfo info) { UN.SetText(_header, info.PopUpLabel); UN.SetText(_body, info.PopUpText); bool okBtn = false; bool cancelBtn = false; switch (info.Mode) { case PopupType.Notification: okBtn = true; break; case PopupType.Question: okBtn = true; cancelBtn = true; break; } UN.SetActive(_ok, okBtn); UN.SetActive(_cancel, cancelBtn); UN.SetActive(_root, true); if (info.StringArgs.Length > 0) { UN.SetText(_okBtnText, info.StringArgs[0]); } else { UN.SetText(_okBtnText, _defaultOkText); } if (info.StringArgs.Length > 1) { UN.SetText(_okBtnText, info.StringArgs[1]); } else { UN.SetText(_okBtnText, _defaultCancelText); } }
void UpdateFields() { if (Dbg.Assert(Property != null)) { return; } UN.SetText(_nameField, Property.Id.ToString()); // might want a mapping for localization if (_showCurAndBaseInText) { UN.SetText(_curValueText, string.Format("{0}/{1}", Mathf.RoundToInt(Property.CurValue), Mathf.RoundToInt(Property.BaseValue))); } else { UN.SetText(_curValueText, Mathf.RoundToInt(Property.CurValue).ToString()); // might want a mapping for localization UN.SetText(_baseValueText, Mathf.RoundToInt(Property.BaseValue).ToString()); // might want a mapping for localization } UN.SetFill(_curValueImage, Property.CurValue); UN.SetFill(_baseValueImage, Property.BaseValue); }
public void RefreshUI() { UN.SetText(_nameText, _combatant.FullName); UN.SetText(_classSpecies, string.Format("{0} {1}", _combatant.Species.DisplayName, _combatant.Class.Id)); }
void UpdateButtons() { UN.SetInteractable(_continueBtn, HasSavedGame()); UN.SetInteractable(_loadBtn, HasSavedGame()); }
IEnumerator SetActivePhase(GM_Phase newPhase) { Debug.Log("set active phase 1 : " + newPhase.GetType().ToString()); UN_CameraFade.ClearAll(); bool readyToSwitch1 = false; UN_CameraFade.FadeToBlack(() => { readyToSwitch1 = true; }, 2.0f); //### PJS TO DO : remove time IEnumerator it; _previousPhase = _curPhase; if (_previousPhase != null) { it = _previousPhase.Exit(newPhase); while (it.MoveNext()) { yield return(null); } UN.SetActive(_previousPhase, false); } // wait for fade to black to be done while (readyToSwitch1 == false) { yield return(null); } _curPhase = newPhase; UN.SetActive(newPhase, true); it = newPhase.Enter(_previousPhase); while (it.MoveNext()) { yield return(null); } string newSceneName = newPhase.SceneName; if (!string.IsNullOrEmpty(newSceneName) && newSceneName != SceneManager.GetActiveScene().name) { AsyncOperation loadingOp = SceneManager.LoadSceneAsync(newSceneName); if (loadingOp != null) { while (loadingOp.isDone == false) { yield return(null); } Events.SendGlobal(new SceneChangedEvent() { Name = _curPhase.SceneName }); } } Events.SendGlobal(new GM_GamePhaseChangedEvent() { NewPhase = _curPhase == null ? null : _curPhase.GetType(), OldPhase = _previousPhase == null ? null : _previousPhase.GetType() }); { bool readyToSwitch2 = false; UN_CameraFade.FadeToTransparent(() => { readyToSwitch2 = true; }, 2.0f); //### pjs todo fix time while (readyToSwitch2 == false) { yield return(null); } } _changingState = false; Debug.Log("set active phase 2 : " + newPhase.GetType().ToString()); }
private void Awake() { _target = GetComponentInParent <SM_ISelectable>(); Refresh(); UN.SetActive(this, false); }
private void Window_Loaded(object sender, RoutedEventArgs e) { Kernel.Core.StartUp_Engine(); UN.Focus(); }
protected override void Awake() { base.Awake(); UN.SetActive(_template, false); }