Dispatch() public method

public Dispatch ( ) : void
return void
        public override void Launch()
        {
            base.Launch();
            Signal startSignal = injectionBinder.GetInstance <StartSignal>() as StartSignal;

            startSignal?.Dispatch();
        }
示例#2
0
        public ApplicationFrame()
        {
            AddChild(new ContactList());

            AddChild(new ContactDetails().SetX(300));
            AddChild(new ContactDetails().SetX(300).SetY(150));

            AddChild(new ContactList().SetX(600));

            AddChild(
                new Button(100, 20, "<= Undo").SetY(370)
                .OnClick(e => SigUndoClicked.Dispatch())
                );
            AddChild(
                new Button(100, 20, "Redo =>").SetX(100).SetY(370)
                .OnClick(e => SigRedoClicked.Dispatch())
                );
        }
示例#3
0
        private void OnLocationClosed(LocationResult result)
        {
            if (result.location != _location)
            {
                return;
            }

            if (!locationClosed)
            {
                locationManager.locationClosedSignal.RemoveListener(OnLocationClosed);
                locationClosed = true;
            }

            if (_popupClosed != null)
            {
                _popupClosed.Dispatch(result);
            }
        }
示例#4
0
    public void OptionSelected(string id)
    {
        actionsTaken.Add(id);
        List <Option> options        = allOptions.data;
        Option        selectedOption = options.Find(option => option._id == id);

        if (selectedOption.isLeaf)
        {
            Debug.Log("Network Call");
            ImpactOptionSelected.Dispatch(actionsTaken);
        }
        else
        {
            List <Option> children = options.FindAll((option) => option.parent == selectedOption._id);
            ClearOptions.Dispatch();
            SpawnOptions.Dispatch(children);
        }
    }
示例#5
0
    void OnDeleteItem(GameObject item)
    {
        AudioController.Instance.SoundPlay("active_item");

        GameObject parentGo = item.transform.parent.gameObject;

        ConfirmListItem temp = parentGo.GetComponent <ConfirmListItem>();

        deleteSignal.Dispatch(temp.obj);


        itemList.Remove(parentGo);
        Destroy(parentGo);
        Grid.repositionNow = true;


        StartCoroutine(process());
    }
示例#6
0
        protected void OnGUI()
        {
            switch (state)
            {
            case ScreenState.IDLE:
                if (GUI.Button(screenUtil.GetScreenRect(.4f, .45f, .2f, .1f), "Start Game"))
                {
                    gameStartSignal.Dispatch();
                }
                break;

            case ScreenState.START_LEVEL:
                if (GUI.Button(screenUtil.GetScreenRect(.4f, .45f, .2f, .05f), "Start Level "))
                {
                    startLevelSignal.Dispatch();
                }
                break;
            }
        }
示例#7
0
文件: MapView.cs 项目: w1r2p1/unitrpg
        void Update()
        {
            var mousePosition     = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            var dimensions        = GetDimensions();
            var mouseGridPosition = dimensions.GetGridPositionForWorldPosition(mousePosition);

            if (Input.GetMouseButtonDown(0))
            {
                MapClicked.Dispatch(mouseGridPosition);
            }
            else if (Input.GetMouseButtonDown(1))
            {
                MapRightClicked.Dispatch(mouseGridPosition);
            }
            else
            {
                MapHovered.Dispatch(mouseGridPosition);
            }
        }
示例#8
0
    public void Signal_RemoveAllListeners_Success()
    {
        // Arrange
        var argsArray = new object[1];
        var actual    = 0;

        // Act
        var signal = new Signal();

        signal.AddListener(ActionRuntime);
        signal.AddListenerOnce(ActionRuntime);
        signal.RemoveAllListeners();
        signal.Dispatch(argsArray);

        void ActionRuntime(ISignal target, object[] args) => actual++;

        //Assert
        Assert.AreEqual(0, actual);
    }
示例#9
0
    public virtual void SetEquipedWeaponType(EquipedWeaponType weaponType)
    {
        mEquipedWeaponType = weaponType;
        mMeleeWeaponModel.SetActive(false);
        mRangedWeaponModel.SetActive(false);

        switch (mEquipedWeaponType)
        {
        case EquipedWeaponType.Melee:
            mMeleeWeaponModel.SetActive(true);
            break;

        case EquipedWeaponType.Ranged:
            mRangedWeaponModel.SetActive(GlobalData.NumAmmo > 0);
            break;
        }

        Signal.Dispatch(SignalType.WeaponChanged);
    }
示例#10
0
        void OnTriggerEnter2D(Collider2D other)
        {
            string otherName = other.gameObject.name;

            if (otherName == WALL_LEFT || otherName == WALL_RIGHT)
            {
                flip();
            }
            else
            {
                Debug.Log("OnTriggerEnter2D. other.tag = " + other.tag + ", name = " + other.gameObject.name);
                bool isPlayer = isPlayerObject(other.tag);
                if (this.enabled && (isPlayer || (isOtherEnemy(other) && isEqualsScaleX(other.gameObject))))
                {
                    GameObject otherGO = (isPlayer) ? null : other.gameObject;
                    triggerEnterSignal.Dispatch(otherGO);
                }
            }
        }
示例#11
0
        void Update()
        {
            Character.Update();
            if (MYXZInputManager.Instance.GetKeyDown(KeyCode.Escape))
            {
                EscSignal.Dispatch();
            }
            mTimer += Time.deltaTime;
            if (mTimer > 60)    //测试使用,每60s随机变换一次天气
            {
                WeatherSystem.ChangeWeather(CurrentSceneWeather[Random.Range(0, CurrentSceneWeather.Length)]);
                mTimer = 0;
            }

            if (MYXZInputManager.Instance.GetKeyDown(KeyCode.Alpha1))
            {
                UseSkillSignal.Dispatch(KeyCode.Alpha1);
            }
        }
示例#12
0
        private void OnRegisterButtonClick()
        {
            //检测下IP的合法性
            IPAddress address;

            if (IPAddress.TryParse(severIP.text, out address))
            {
                LogInInfo li = new LogInInfo(userName.text, severIP.text);
                logInButtonClickSignal.Dispatch(li);
            }
            else
            {
                DialogBoxMsg msg = new DialogBoxMsg();
                msg.tittle       = "服务器IP不正确";
                msg.msg          = "请您输入正确的IP地址";
                msg.resultSignal = null;
                dialogBoxSignal.Dispatch(msg);
            }
        }
示例#13
0
        private void OnCopyLine(ILineModel lineModel, bool selected)
        {
            foreach (ProjectItem projectItem in _itemLines)
            {
                if (projectItem.LineModel.Guid != lineModel.Guid)
                {
                    projectItem.DeselectCopy();
                }
            }

            if (selected)
            {
                LineCopiedSignal.Dispatch(lineModel);
            }
            else
            {
                LineResetSignal.Dispatch();
            }
        }
示例#14
0
    void Update()
    {
        if (isTouched)
        {
            Vector3 pos      = transform.position;
            Vector3 inputPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            pos.x = inputPos.x;
            pos.y = inputPos.y;

            pos.x = Mathf.Clamp(pos.x, boundary.xMin, boundary.xMax);
            pos.y = Mathf.Clamp(pos.y, boundary.yMin, boundary.yMax);

            transform.position = pos;

            if (isTouchDownFirstTime)
            {
                FirstTimeTouchSignal.Dispatch();
            }
        }
    }
示例#15
0
        public static MenuStateMachine CreateStateMachine(HashSet <BubbleMenuItem> items)
        {
            var sentinelStartValue = "base";
            var machine            = new StateMachine <string, string>(sentinelStartValue);
            var selectSignal       = new Signal <string>();
            var deepenSignal       = new Signal <StateMachine <string, string> .Transition>();
            var closeSignal        = new Signal();

            machine.Configure("dispatch")
            .OnEntry(transition => selectSignal.Dispatch(transition.Trigger));

            machine.Configure("base")
            .Permit("Back", "closed");

            machine.Configure("closed")
            .OnEntry(transition => closeSignal.Dispatch());

            machine = CreateStateMachine(machine, sentinelStartValue, null, items, deepenSignal);

            return(new MenuStateMachine(deepenSignal, closeSignal, selectSignal, machine));
        }
示例#16
0
    public override void OnDeath()
    {
        base.OnDeath();
        SoundManager.Instance.PlaySfx(SoundManager.Instance.sfx_monster_pop, .35f);
        int heartValue = Random.Range(mMinHeartsValue, mMaxHeartsValue + 1);

        if (heartValue > 0)
        {
            HeartProjectile heart = DropHeart(heartValue);
            if (mIsBoss)
            {
                heart.transform.localScale *= 2;
            }
        }


        if (mIsBoss)
        {
            Signal.Dispatch(SignalType.BossDefeated);
        }
    }
示例#17
0
        public IEnumerator Attack(ICombatant receiver, WeaponHitSeverity severity)
        {
            var attackComplete = false;
            var onComplete     = new Action(() => {
                attackComplete = true;
            });

            _animator.AttackConnectedSignal.AddOnce(() => {
                var connection = new WeaponHitConnection(severity, receiver);
                AttackConnectedSignal.Dispatch(connection);
            });

            _animator.AttackCompleteSignal.AddOnce(onComplete);
            State = CombatantState.Attacking;

            while (!attackComplete)
            {
                yield return(new WaitForEndOfFrame());
            }
            State = CombatantState.CombatReady;
        }
示例#18
0
        /************************************************Unity方法与事件***********************************************/
        protected override void Start()
        {
            base.Start();
#if (UNITY_ANDROID) && (!UNITY_EDITOR)
            RegisterDrinkWater();
#endif
            sleepTimeManager.ResetSleepStatus();
            Application.targetFrameRate = 12;
            bInAni = false;
            objControl.SetActive(false);
            autoDrink = false;
#if UNITY_EDITOR
            objControl.SetActive(true);
#endif
#if CUP_AUTOTEST
            autoDrink = true;
#else
            showNoviceGuideView.Dispatch();
#endif
            this.VolumeSetting.SetCurrentVolume();
        }
示例#19
0
        void FixedUpdate()
        {
            if (duration != -1)
            {
                lasts -= (Time.deltaTime * 1000);
                if (lasts <= 0)
                {
                    if (isRepeated)
                    {
                        lasts = duration;
                    }
                    else
                    {
                        duration = -1;
                        Dispose();
                    }

                    onTime.Dispatch();
                }
            }
        }
示例#20
0
 void OnConfirmClick(GameObject go)
 {
     AudioController.Instance.SoundPlay("active_item");
     if (panelScript.zhuihaoToggle.value)  //追号下单  改变逻辑后这里永远为false
     {
         int             zzs = 0;
         ZhuihaoOrderObj obj = new ZhuihaoOrderObj();
         obj.cfirmObj  = ConfirmObjList[0];
         obj.bingoStop = panelScript.stopToggle.value?1:0;
         obj.beishu    = int.Parse(panelScript.beishu.value);
         obj.qishu     = int.Parse(panelScript.zhuiqi.value);
         obj.zhzje     = Getzje(ref zzs);
         zhuihaoSignal.Dispatch(obj);
         DeleteAll(); //去追号的话,还是需要删除
     }
     else             //普通下单
     {
         if (ConfirmObjList.Count > 100)
         {
             MsgSignal.Dispatch(new MsgPara("一次提交的订单过多,请重新下单", 2));
             return;
         }
         if (ConfirmObjList.Count == 0)
         {
             MsgSignal.Dispatch(new MsgPara("请先下单", 2));
             return;
         }
         Loading.GetInstance().ShowLoading("数据正在加载中.......");
         orderSign.Dispatch(ConfirmObjList);
         TimeManager.Instance().Register("checkOrder", 1, 1000, 15000, (c, t) =>
         {
             if (!Global.IsAppOrderRsp)
             {
                 Loading.GetInstance().HideLoading();
                 Global.IsAppOrderRsp = false;
                 MsgSignal.Dispatch(new MsgPara("抱歉,由于网络波动下单有可能异常,请查看您的下单记录进行确认", 2));
             }
         });
     }
 }
    public override void Execute()
    {
        var channel = ChatServerData.ServerChannels.Find(c => c.ChannelId == Message.ChannelId);

        if (channel != null)
        {
            channel.Members.Add(new ChatChannelMember()
            {
                MemberId   = Message.MemberId,
                MemberName = Message.MemberName
            });
            Signal.Dispatch(new JoinChannelResponseMessage()
            {
                ChannelId = Message.ChannelId,
                Joined    = true
            });

            PlayFabServerAPI.WritePlayerEvent(new WriteServerPlayerEventRequest()
            {
                EventName = "PlayerJoinedChat",
                PlayFabId = Message.MemberId,
                Body      = new Dictionary <string, object>()
                {
                    { "ChannelId", channel.ChannelId },
                }
            }, null, (error) => {
                Debug.LogError(error.GenerateErrorReport());
            });
        }
        else
        {
            Signal.Dispatch(new JoinChannelResponseMessage()
            {
                ChannelId = Message.ChannelId,
                Joined    = false,
                Error     = "Failed to Join Server."
            });
        }
    }
示例#22
0
        virtual public AFObject Add(AFObject obj)
        {
            AFObject L_object = GetObjectByName(obj.name);

            if (L_object == null)
            {
                L_object = obj;
                m_objects.Add(L_object);
                L_object.gameObject.transform.parent = this.gameObject.transform;
            }
            else
            {
                UnityEngine.Debug.LogWarning("The object already in the State: " + L_object.name);
            }

            if (m_hasEvents)
            {
                OnObjectAdded.Dispatch(L_object);
            }

            return(L_object);
        }
示例#23
0
    public void Signal_AddListenerAndDispatch_Success()
    {
        // Arrange
        var expectedArgs   = new object[1];
        var expectedSignal = new Signal();
        var actualTarget   = default(ISignal);
        var actualArgs     = default(object[]);

        // Act
        expectedSignal.AddListener(ActionRuntime);
        expectedSignal.Dispatch(expectedArgs);

        void ActionRuntime(ISignal target, object[] args)
        {
            actualTarget = target;
            actualArgs   = args;
        }

        //Assert
        Assert.AreEqual(expectedArgs, actualArgs);
        Assert.AreEqual(expectedSignal, actualTarget);
    }
示例#24
0
        protected void OnGUI()
        {
            //display the correct UI, based on ScreenState
            switch (state)
            {
            case ScreenState.IDLE:
                if (GUI.Button(screenUtil.GetScreenRect(.4f, .45f, .2f, .1f), "Start Game"))
                {
                    startGameSignal.Dispatch();
                }
                GUI.TextField(screenUtil.GetScreenRect(0f, 0f, .4f, .05f), "Last Score: " + score);
                break;

            case ScreenState.START_LEVEL:
                if (GUI.Button(screenUtil.GetScreenRect(.4f, .45f, .2f, .05f), "Start Level " + level))
                {
                    startLevelSignal.Dispatch();
                }
                GUI.TextField(screenUtil.GetScreenRect(.4f, .5f, .4f, .05f), "Score: " + score);
                GUI.TextField(screenUtil.GetScreenRect(.4f, .55f, .4f, .05f), "Lives remaining: " + lives);
                break;

            case ScreenState.END_GAME:
                if (GUI.Button(screenUtil.GetScreenRect(.45f, .1f, .2f, .1f), "Play Again"))
                {
                    startGameSignal.Dispatch();
                }
                GUI.TextField(screenUtil.GetScreenRect(.45f, .2f, .4f, .05f), "Final Score: " + score);
                break;

            case ScreenState.LEVEL_IN_PROGRESS:
                GUI.TextField(screenUtil.GetScreenRect(0f, 0f, .4f, .05f), "Score: " + score);
                GUI.TextField(screenUtil.GetScreenRect(.6f, 0f, .4f, .05f), "Lives Remaining: " + lives);
                GUI.TextField(screenUtil.GetScreenRect(0f, .95f, .2f, .05f), "Level: " + level);
                break;
            }
        }
    public void onClick(string clickedIndex)
    {
        if (isClicked || isGameOver)
        {
            return;
        }

        Text markObject = null;

        switch (currentMark)
        {
        case "x":
            markObject = GameObject.Instantiate(xObj, Vector3.zero, Quaternion.identity);
            break;

        case "o":
            markObject = GameObject.Instantiate(oObj, Vector3.zero, Quaternion.identity);
            break;
        }
        markObject.transform.parent            = this.transform;
        markObject.rectTransform.localPosition = Vector3.zero;
        areaClicked.Dispatch(clickedIndex);
        isClicked = true;
    }
示例#26
0
        public AddressBookContext(AddressBookModule module) : base(module.Gui, module.Scene, new StandardKernel(module))
        {
            // map app frame to its mediator
            MapView <ApplicationFrame, ApplicationFrameMediator>();
            // map contact list to its mediator
            MapView <ContactList, ContactListMediator>();
            MapView <ContactDetails, ContactDetailsMediator>();

            // map signals to command
            var inputSignals = module.InputSignals;

            MapSignal(inputSignals.Undo, e => Undo());
            MapSignal(inputSignals.Redo, e => Redo());

            MapSignal(inputSignals.CreateContact, typeof(CreateContactCommand));
            MapSignal(inputSignals.SelectContact, typeof(SelectContactCommand));
            MapSignal(inputSignals.EditContact, typeof(EditContactCommand));

            // run the StartUpCommanfd
            var startUpSignal = new Signal();

            MapSignal(startUpSignal, typeof(StartUpCommand));
            startUpSignal.Dispatch();
        }
示例#27
0
 public void Select()
 {
     SelectedSignal.Dispatch(SaveGame);
 }
示例#28
0
 private void OnRotateCameraSpeedValueChanged(float value)
 {
     RotateCameraSpeedValueChanged.Dispatch(value);
 }
示例#29
0
 void ToggleStatusChanged(bool status)
 {
     EquipmentSelectToggleChangedSignal.Dispatch(status);
 }
示例#30
0
 private void OnRotateCameraValueChanged(bool enabled)
 {
     RotateCameraValueChangedSignal.Dispatch(enabled);
     _rotateCameraSpeedSlider.gameObject.SetActive(enabled);
     LayoutRebuilder.ForceRebuildLayoutImmediate(_verticalLayoutRectTransform);
 }