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()); }
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 } }
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 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 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)); }