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); }
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); } }
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); }
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); } }
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); }
private void CreatedTouchOrder(NotifyParam obj) { StartCoroutine(ShowTouchOrder()); }
private void HideTurnMessage(NotifyParam obj) { dispatcher.Dispatch(GameEvents.UPDATE_LIFE); Debug.Log("HIDE TURN MESSAGE " + gameModel.Life); }
private void ShowTurnMessage(NotifyParam obj) { StartCoroutine(StartTurn()); }
virtual public void Execute(NotifyParam notify) { }
private void HideTurnMessage(NotifyParam obj) { //_viewComp.enabled = false; _viewComp.turnMessageTxt.enabled = false; _panel.SetActive(false); }
private void ItemActive(NotifyParam obj) { Debug.Log("COLLIDER ACTIVE"); coll.enabled = true; }
internal void OnHandlerNotify(NotifyParam notify, Action<NotifyParam> callback) { callback(notify); }
public void Dispatch(object dispatchKey) { NotifyParam notify = new NotifyParam(dispatchKey, null, null); commandMap.ExecuteCommand(notify); SendNotifyToObject(notify); }
public void Dispatch(object dispatchKey, object dispatchParam, object dispatchMsg) { NotifyParam notify = new NotifyParam(dispatchKey, dispatchParam, dispatchMsg); commandMap.ExecuteCommand(notify); SendNotifyToObject(notify); }
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)); } } }
public override void Execute(NotifyParam notify) { Application.Quit(); }
private void UpdateLife(NotifyParam obj) { MyGameModel gameModel = uManager.GetModel<IMyGameModel>() as MyGameModel; _viewComp.lifeTxt.text = gameModel.Life.ToString(); }
public override void Execute(NotifyParam notify) { SceneManager.LoadScene("MainMenu"); }
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); }
private void CreateTouchOrderHandler(NotifyParam obj) { Debug.Log("COLLIDER DEACTIVE"); coll.enabled = false; }