Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
 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();
     }
 }
Ejemplo n.º 3
0
 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);
        }
Ejemplo n.º 5
0
        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());
        }
Ejemplo n.º 6
0
 private void UN_Click_1(object sender, EventArgs e)
 {
     if (UN.ForeColor == Color.Gray)
     {
         UN.Clear();
         UN.ForeColor = Color.Black;
     }
 }
Ejemplo n.º 7
0
        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);
     }
 }
Ejemplo n.º 9
0
        public void EnterUsername(string un)
        {
            int trimLength = 5;

            if (UN.Length > trimLength)
            {
                UN = UN.Remove(trimLength);
            }
        }
Ejemplo n.º 10
0
        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());
        }
Ejemplo n.º 11
0
 void OnClick(bool response)
 {
     if (_info.CloseOnFinish)
     {
         UN.SetActive(_root, false);
     }
     if (_info.Callback != null)
     {
         _info.Callback(response);
     }
 }
Ejemplo n.º 12
0
        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));
        }
Ejemplo n.º 13
0
 protected override void OnEnable()
 {
     base.OnEnable();
     UpdateButtons();
     if (HasSavedGame())
     {
         UN.SetSelected(_continueBtn);
     }
     else
     {
         UN.SetSelected(_newBtn);
     }
     Events.AddGlobalListener <LG_NewLeagueInitializationFinishedEvent>(OnNewLeagueCreationFinished);
 }
Ejemplo n.º 14
0
 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);
     }
 }
Ejemplo n.º 15
0
        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
            }
        }
Ejemplo n.º 16
0
        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);
        }
Ejemplo n.º 17
0
        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]);
            }
        }
Ejemplo n.º 18
0
 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();
     }
 }
Ejemplo n.º 19
0
        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);
            }
        }
Ejemplo n.º 20
0
        // 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;
        }
Ejemplo n.º 21
0
 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();
     }
 }
Ejemplo n.º 22
0
        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);
            }
        }
Ejemplo n.º 23
0
        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);
        }
Ejemplo n.º 24
0
 public void RefreshUI()
 {
     UN.SetText(_nameText, _combatant.FullName);
     UN.SetText(_classSpecies, string.Format("{0} {1}", _combatant.Species.DisplayName, _combatant.Class.Id));
 }
Ejemplo n.º 25
0
 void UpdateButtons()
 {
     UN.SetInteractable(_continueBtn, HasSavedGame());
     UN.SetInteractable(_loadBtn, HasSavedGame());
 }
Ejemplo n.º 26
0
        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());
        }
Ejemplo n.º 27
0
 private void Awake()
 {
     _target = GetComponentInParent <SM_ISelectable>();
     Refresh();
     UN.SetActive(this, false);
 }
Ejemplo n.º 28
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     Kernel.Core.StartUp_Engine();
     UN.Focus();
 }
Ejemplo n.º 29
0
 protected override void Awake()
 {
     base.Awake();
     UN.SetActive(_template, false);
 }