Example #1
0
 private void ShowTurnMessage(NotifyParam obj)
 {
     TurnMessageParam param = obj.data as TurnMessageParam;
     _viewComp.turnMessageTxt.text = param.message;
     _viewComp.turnMessageTxt.enabled = true;
     //_viewComp.enabled = true;
     _panel.SetActive(true);
 }
Example #2
0
 private void ShowTouch(NotifyParam obj)
 {
     int showIndex = (int)obj.data;
     //Debug.Log("HideTouch: " + showIndex.ToString() + " || " + _view.itemIndex.ToString());
     if (showIndex == _view.itemIndex)
     {
         LoadSprite(1);
     }
 }
        public override void Execute(NotifyParam notify)
        {
            Collider2D collision = notify.data as Collider2D;
            
            LaserView laserView = collision.gameObject.GetComponent<LaserView>();

            if (laserView)
            {
                laserView.gameObject.SetActive(false);
            }
        }
Example #4
0
        public override void Execute(NotifyParam notify)
        {
            MyGameModel gameModel = uManager.GetModel<IMyGameModel>() as MyGameModel;

            string sceneName = notify.data as string;



            gameModel.Life = 1;

            SceneManager.LoadScene(sceneName);
        }
        public override void Execute(NotifyParam notify)
        {
            MyGameModel gameModel = uManager.GetModel<IMyGameModel>() as MyGameModel;

            gameModel.TouchOrder = new List<int>();

            int random = Random.Range(1, 3);
            gameModel.TouchOrder.Add(random);
            Debug.Log("Random: " + random);

            random = Random.Range(1, 3);
            gameModel.TouchOrder.Add(random);
            Debug.Log("Random: " + random);

            random = Random.Range(1, 3);
            gameModel.TouchOrder.Add(random);
            Debug.Log("Random: " + random);
        }
Example #6
0
        protected internal void ExecuteCommand(NotifyParam param)
        {
            IBinding binding = GetBind(param.key);

            if (binding == null)
            {
                return;
            }

            Dictionary <object, object> binded = binding.Binded;

            foreach (KeyValuePair <object, object> pair in binded)
            {
                Type     cmd     = pair.Value as Type;
                ICommand command = (ICommand)Activator.CreateInstance(cmd);
                command.Execute(param);
            }
        }
Example #7
0
        private void CheckTouchOrder(NotifyParam obj)
        {
            List<int> touchOrder = gameModel.TouchOrder;

            bool check = true;

            for (int i = 0; i < touchOrder.Count; i++)
            {
                if (touchOrder[i] != clientTouchOrder[i])
                {
                    check = false;
                    break;
                }
            }

            clientTouchOrder = new List<int>();

            TurnMessageParam turnMessageParam = new TurnMessageParam();
            turnMessageParam.isCorrect = check;
            if (check)
            {
                turnMessageParam.message = "WELL DONE!!!";
            }
            else
            {
                gameModel.Life--;
                turnMessageParam.message = "SORRY!!!";
            }

            dispatcher.Dispatch(GameEvents.SHOW_TURN_MESSAGE, turnMessageParam);
        }
Example #8
0
        private void CreatedTouchOrder(NotifyParam obj)
        {

            StartCoroutine(ShowTouchOrder());
        }
Example #9
0
        private void HideTurnMessage(NotifyParam obj)
        {
            dispatcher.Dispatch(GameEvents.UPDATE_LIFE);

            Debug.Log("HIDE TURN MESSAGE " + gameModel.Life);
        }
Example #10
0
 private void ShowTurnMessage(NotifyParam obj)
 {
     StartCoroutine(StartTurn());
 }
Example #11
0
 virtual public void Execute(NotifyParam notify)
 {
 }
Example #12
0
 private void HideTurnMessage(NotifyParam obj)
 {
     //_viewComp.enabled = false;
     _viewComp.turnMessageTxt.enabled = false;
     _panel.SetActive(false);
 }
Example #13
0
 private void ItemActive(NotifyParam obj)
 {
     Debug.Log("COLLIDER ACTIVE");
     coll.enabled = true;
 }
Example #14
0
 internal void OnHandlerNotify(NotifyParam notify, Action<NotifyParam> callback)
 {
     callback(notify);
 }
Example #15
0
 public void Dispatch(object dispatchKey)
 {
     NotifyParam notify = new NotifyParam(dispatchKey, null, null);
     commandMap.ExecuteCommand(notify);
     SendNotifyToObject(notify);
 }
Example #16
0
 public void Dispatch(object dispatchKey, object dispatchParam, object dispatchMsg)
 {
     NotifyParam notify = new NotifyParam(dispatchKey, dispatchParam, dispatchMsg);
     commandMap.ExecuteCommand(notify);
     SendNotifyToObject(notify);
 }
Example #17
0
        private void SendNotifyToObject(NotifyParam notify)
        {
            if(dispatchList.ContainsKey(notify.key))
            {
                Dictionary<Action<NotifyParam>, uGaMaBehaviour> actions = dispatchList[notify.key];

                for (int i = 0; i < actions.Count; i++)
                {
                    uGaMaBehaviour tmpBehavior = actions.Values.ElementAt(i);
                    tmpBehavior.OnHandlerNotify(notify, actions.Keys.ElementAt(i));
                }
            }
        }
Example #18
0
 public override void Execute(NotifyParam notify)
 {
     Application.Quit();
 }
Example #19
0
 virtual public void Execute(NotifyParam notify) { }
Example #20
0
 private void UpdateLife(NotifyParam obj)
 {
     MyGameModel gameModel = uManager.GetModel<IMyGameModel>() as MyGameModel;
     _viewComp.lifeTxt.text = gameModel.Life.ToString();
 }
Example #21
0
        public override void Execute(NotifyParam notify)
        {

            SceneManager.LoadScene("MainMenu");
        }
Example #22
0
        private void TouchHandler(NotifyParam obj)
        {
            int clientTouchIndex = (int)obj.data;
            List<int> touchOrder = gameModel.TouchOrder;
            clientTouchOrder.Add(clientTouchIndex);
            Debug.Log("GAME MED CLICKED");
            if (clientTouchOrder.Count == touchOrder.Count)
            {
                RemoveListener(GameEvents.TOUCH, TouchHandler);
                dispatcher.Dispatch(GameEvents.CHECK_TOUCH_ORDER);
            }

            //Debug.Log("TOUCH HANDLER: " + obj.data);
        }
Example #23
0
 private void CreateTouchOrderHandler(NotifyParam obj)
 {
     Debug.Log("COLLIDER DEACTIVE");
     coll.enabled = false;
 }