Exemplo n.º 1
0
        public static ScopeChecker GetScopeChecker(float minDist, float angle)
        {
            ScopeChecker result = Pooling <ScopeChecker> .From();

            result.Reinit(minDist, angle);
            return(result);
        }
Exemplo n.º 2
0
        public virtual void Init()
        {
            Grid = CreateGrid();
            Grid.OnGetGridShapeAssets = GetGridAssets;

            Grid.GridID     = transform.GetInstanceID();
            Grid.ShouldLine = m_ShouldLine;
            Grid.GridTrans  = transform;
            Grid.GridBg     = m_GridBg;
            Grid.IsObstacle = m_IsObstacle;

            Grid.GridType          = m_GridTypeValue;
            Grid.GridSprite        = m_Grid;
            Grid.GridLocalScale    = m_GridScale;
            Grid.GridLocalPosition = m_GridLocalPosOffset;
            Grid.GridCollider      = m_GridCollider;
            Grid.LineRenderer      = m_GridLineRenderer;

            GetGridAssets(Grid, Grid.GridType);

            IParamNotice <ElimlnateGrid> notice = Pooling <ParamNotice <ElimlnateGrid> > .From();

            notice.ParamValue = Grid;

            int noticeName = GetInstanceID();

            noticeName.Broadcast(notice);
            notice.ToPool();
        }
Exemplo n.º 3
0
    /// <summary>
    /// 派发观察者消息
    /// </summary>
    /// <param name="target"></param>
    /// <param name="noticeName"></param>
    /// <param name="notice"></param>
    public static void Dispatch(this INotificationSender target, int noticeName, INoticeBase <int> notice = default)
    {
        bool defaultNotice = notice == default;

        if (defaultNotice)
        {
            notice = Pooling <Notice> .From();
        }
        else
        {
        }

        notice.SetNoticeName(noticeName);
        notice.NotifcationSender = target;

        NotificatonsInt.Instance.Notificater.Dispatch(notice);

        if (defaultNotice)
        {
            Pooling <Notice> .To(notice as Notice);
        }
        else
        {
        }
    }
Exemplo n.º 4
0
        public override void Init()
        {
            base.Init();

            ShipDockApp app = ShipDockApp.Instance;

            Datas = app.Datas;
            ABs   = app.ABs;
            UIs   = app.UIs;

            if (mUI == default)
            {
                GameObject prefab = ABs.Get(ABName, UIAssetName);
                GameObject ui     = UnityEngine.Object.Instantiate(prefab, UIs.UIRoot.MainCanvas.transform);

                ParamNotice <MonoBehaviour> notice = Pooling <ParamNotice <MonoBehaviour> > .From();

                int id = ui.GetInstanceID();
                id.Broadcast(notice);

                mUI = (T)notice.ParamValue;
                notice.ToPool();
            }
            else
            {
            }

            UILayer layer = mUI.GetComponent <UILayer>();

            SetUIParent(ref layer);
            mUI.Add(UIModularHandler);
        }
Exemplo n.º 5
0
        private INoticeBase <int> OnAIChoosePlayerCardHeroCreate(int noticeName)
        {
            HeroNotice heroNotice = Pooling <HeroNotice> .From();

            heroNotice.camp = Consts.CAMP_PLAYER;
            return(heroNotice);
        }
Exemplo n.º 6
0
        protected override void Start()
        {
            base.Start();

            if (m_ApplyInitSelf)
            {
                IUIStack stack = CreateModular();
                if (stack != default)
                {
                    UIs.Open <UIStack>(stack.Name, () =>
                    {
                        UIs.BindResourcesUIToStack(stack, gameObject, ActiveSelfControlHide);
                        return(stack);
                    });
                }
                else
                {
                }

                ParamNotice <MonoBehaviour> notice = Pooling <ParamNotice <MonoBehaviour> > .From();

                int noticeName = GetInstanceID();
                noticeName.Broadcast(notice);
                notice.ToPool();
            }
            else
            {
            }
        }
Exemplo n.º 7
0
        private void SendLoadedNotice()
        {
            if (m_LoadedNoticeInfo.IsSendIDAsNotice && !m_LoadedNoticeInfo.IsReadyNoticeSend)
            {
                if (m_LoadedNoticeInfo.ApplyDefaultNoticeType)
                {
                    mIDAsNotice = Pooling <Notice> .From();
                }
                else
                {
                    ApplyCustomNotice();
                }

                if (m_LoadedNoticeInfo.ApplyCallLate)
                {
                    UpdaterNotice.SceneCallLater(SendLoadedNoticeAndRelease);
                }
                else
                {
                    SendLoadedNoticeAndRelease(0);
                }
            }
            else
            {
            }
        }
Exemplo n.º 8
0
        void IPlatformSDK.Init()
        {
            if (mMessageBody == null)
            {
                ParamNotice <SDKMessages> notice = Pooling <ParamNotice <SDKMessages> > .From();

                SDKMessages.N_GET_SDK_MESSAGES_REF.Broadcast(notice);
                mMessageBody = notice.ParamValue;
                Pooling <ParamNotice <SDKMessages> > .To(notice);
            }
            else
            {
            }

            if (mMainActivity == null)
            {
                using (AndroidJavaClass mClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
                {
                    mMainActivity = mClass.GetStatic <AndroidJavaObject>("currentActivity");
                    mMainActivity.Call("setUnityCallbackBody", mMessageBody.TargetName, mMessageBody.MethodName);
                }
            }
            else
            {
            }
        }
Exemplo n.º 9
0
        private INoticeBase <int> OnPlayerCardGenerateCreat(int noticeName)
        {
            CardNotice cardNotice = Pooling <CardNotice> .From();

            cardNotice.camp = Consts.CAMP_PLAYER;
            return(cardNotice);
        }
Exemplo n.º 10
0
        public static void RemoveSceneUpdater(IUpdate target)
        {
            UpdaterNotice notice = Pooling <UpdaterNotice> .From();

            notice.ParamValue = target;
            ShipDockConsts.NOTICE_REMOVE_SCENE_UPDATE.Broadcast(notice);
            Pooling <UpdaterNotice> .To(notice);
        }
Exemplo n.º 11
0
        public static void SceneCallLater(Action <int> target)
        {
            ParamNotice <Action <int> > notice = Pooling <ParamNotice <Action <int> > > .From();

            notice.ParamValue = target;
            ShipDockConsts.NOTICE_SCENE_CALL_LATE.Broadcast(notice);
            Pooling <ParamNotice <Action <int> > > .To(notice);
        }
Exemplo n.º 12
0
        public static void AddUpdater(IUpdate target)
        {
            UpdaterNotice notice = Pooling <UpdaterNotice> .From();

            notice.ParamValue = target;
            ShipDockConsts.NOTICE_ADD_UPDATE.Broadcast(notice);
            Pooling <UpdaterNotice> .To(notice);
        }
Exemplo n.º 13
0
        private void Awake()
        {
            Events  = new NoticesObserver();
            mMapper = new StringIntValueList();

            mUIAreaNotice = Pooling <ParamNotice <UIDisplay> > .From();

            mUIAreaNotice.SetNoticeName(N_UI_AREA_CHANGED);
        }
Exemplo n.º 14
0
        public static void AddUpdater(IUpdate target)
        {
            UpdaterNotice notice = Pooling <UpdaterNotice> .From();

            notice.ParamValue = target;
            notice.SetNoticeName(ShipDockConsts.NOTICE_ADD_UPDATE);
            NotificatonsInt.Instance.Notificater.Broadcast(notice);
            notice.ToPool();
        }
Exemplo n.º 15
0
        public static void SceneCallLater(Action <int> target)
        {
            SceneCallLaterNotice notice = Pooling <SceneCallLaterNotice> .From();

            notice.ParamValue = target;
            notice.SetNoticeName(ShipDockConsts.NOTICE_SCENE_CALL_LATE);
            NotificatonsInt.Instance.Notificater.Broadcast(notice);
            notice.ToPool();
        }
Exemplo n.º 16
0
        void IPlatformSDK.Init()
        {
            init();
            onStart();

            ParamNotice <SDKMessages> notice = Pooling <ParamNotice <SDKMessages> > .From();

            SDKMessages.N_GET_SDK_MESSAGES_REF.Broadcast(notice);
            mMessageBody = notice.ParamValue;
            Pooling <ParamNotice <SDKMessages> > .To(notice);
        }
Exemplo n.º 17
0
        private void SetRoleCamp()
        {
            (mRole as FWRole).Camp = m_Camp;
            if (m_Camp == 0)
            {
                ParamNotice <RoleEntitas> notice = Pooling <ParamNotice <RoleEntitas> > .From();

                notice.ParamValue = mRole;
                FWConsts.COMPONENT_ROLE_CONTROLLABLE.Broadcast(notice);
                Pooling <ParamNotice <RoleEntitas> > .To(notice);
            }
        }
Exemplo n.º 18
0
        private void SendRoleFSMStateNotifications(ref INotificationSender target, ref NotificationInfo[] list)
        {
            Notice notice = Pooling <Notice> .From();

            int max = list.Length;

            for (int i = 0; i < max; i++)
            {
                target.Dispatch(list[i].noticeName, notice);
            }
            notice.ToPool();
        }
Exemplo n.º 19
0
        private void OnAIChoosePlayerCardHero(INoticeBase <int> param)
        {
            Debug.Log("OnAIChoosePlayerCardHero 1");
            HeroNotice notice = param as HeroNotice;

            AIRatioNotice AIRatioNotice = Pooling <AIRatioNotice> .From();

            AIRatioNotice.camp = notice.camp;
            NotifyModular(Consts.N_SET_GENERAL_INTO_BATTLE_RATIO, AIRatioNotice);
            NotifyModular(Consts.N_COMMIT_PLAYER_AI, notice);

            AIRatioNotice.ToPool();
        }
Exemplo n.º 20
0
        private void Awake()
        {
            Events         = new NoticesObserver();
            mChangedNotice = Pooling <ParamNotice <UIDisplay> > .From();

            mChangedNotice.SetNoticeName(N_UI_DISPLAY_SELECTED);

            if (string.IsNullOrEmpty(m_GroupID))
            {
                throw new Exception("UIDisplay group id do not allow empty.");
            }
            else
            {
            }
        }
Exemplo n.º 21
0
        public override void Init()
        {
            base.Init();

            Datas = ShipDockApp.Instance.Datas;
            ABs   = ShipDockApp.Instance.ABs;
            UIs   = ShipDockApp.Instance.UIs;

            GameObject prefab = ABs.Get(ABName, UIName);
            GameObject ui     = Object.Instantiate(prefab, UIs.UIRoot.MainCanvas.transform);

            ParamNotice <MonoBehaviour> notice = Pooling <ParamNotice <MonoBehaviour> > .From();

            int id = ui.GetInstanceID();

            id.Broadcast(notice);

            mUI = (T)notice.ParamValue;
            Pooling <ParamNotice <MonoBehaviour> > .To(notice);
        }
Exemplo n.º 22
0
        private void OnSceneUpdateReady(INoticeBase <int> obj)
        {
            ShipDockConsts.NOTICE_SCENE_UPDATE_READY.Remove(OnSceneUpdateReady);

            MethodUpdater updater = ShipDockComponentManagerSetting.isMergeUpdateMode ?
                                    new MethodUpdater
            {
                Update = MergeComponentUpdateModeInScene
            } :
            new MethodUpdater
            {
                Update = SingleFrameComponentUpdateModeInScene
            };

            UpdaterNotice notice = Pooling <UpdaterNotice> .From();

            notice.ParamValue = updater;
            ShipDockConsts.NOTICE_ADD_SCENE_UPDATE.Broadcast(notice);
            Pooling <UpdaterNotice> .To(notice);
        }
Exemplo n.º 23
0
        void Init()
        {
            ParamNotice <SDKMessages> notice = Pooling <ParamNotice <SDKMessages> > .From();

            SDKMessages.N_GET_SDK_MESSAGES_REF.Broadcast(notice);
            mMessageBody = notice.ParamValue;
            Pooling <ParamNotice <SDKMessages> > .To(notice);

            using (AndroidJavaClass mClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
            {
                mMainActivity = mClass.GetStatic <AndroidJavaObject>("currentActivity");
            }
            mMainActivity.Call("setUnityCallbackBody", mMessageBody.TargetName, mMessageBody.MethodName);
            mWechat       = mMainActivity.Call <AndroidJavaObject>("getWXSDK");
            mAlipay       = mMainActivity.Call <AndroidJavaObject>("getAlipaySDK");
            mNative       = mMainActivity.Call <AndroidJavaObject>("getNativeUtil");
            mSmartOralEva = mMainActivity.Call <AndroidJavaObject>("getSmartOral");
            mTalkingData  = mMainActivity.Call <AndroidJavaObject>("getTalkingData");
            mTalkingData.Call("init", SDKMessages.SDKChannel);
        }
Exemplo n.º 24
0
        private void ApplyCustomNotice()
        {
            string methodName = m_LoadedNoticeInfo.GetIDAsCustomNoticeMethod;

            if (string.IsNullOrEmpty(methodName))
            {
                mIDAsNotice = Pooling <Notice> .From();
            }
            else
            {
                ILRuntimeUtils.InvokeMethodILR(ShellBridge, m_StartUpInfo.ClassName, methodName, 0, OnGetIDAsNoticeHandler);
                if (mIDAsNotice == default)
                {
                    mIDAsNotice = Pooling <Notice> .From();
                }
                else
                {
                }
            }
        }
Exemplo n.º 25
0
        // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
        override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            IsDuringState = true;

            mNoticeName = animator.GetInstanceID();
            mNotice     = Pooling <ParamNotice <AniStateBehaviour> > .From();

            mNotice.ParamValue = this;

            if (m_ApplyFSM)
            {
                mParamName = m_AniSubgroup.ParamName;
            }
            else
            {
            }

            m_MotionCompleted = 0;

            SendAniStateNotice();
            StateEffectsEntered();
        }
Exemplo n.º 26
0
        private void Update()
        {
            if (isActive)
            {
                if (mFPSNotice == null)
                {
                    mFPSNotice = Pooling <ParamNotice <int> > .From();
                }
                else
                {
                }

                mFrameCount++;
                mTimeDelta = Time.realtimeSinceStartup - mLastShowTime;
                if (mTimeDelta >= showTimeGap)
                {
                    mFPS          = mFrameCount / mTimeDelta;
                    mFrameCount   = 0;
                    mLastShowTime = Time.realtimeSinceStartup;
                }
                else
                {
                }

                mFrameRate = (int)mFPS;
                ShipDockConsts.NOTICE_FPS_SHOW.BroadcastWithParam(mFrameRate);
                if (m_FrameRateText != default)
                {
                    mFrameRateValue      = mFrameRate.ToString();
                    m_FrameRateText.text = mFrameRateValue;
                }
                else
                {
                }
            }
            else
            {
            }
        }
Exemplo n.º 27
0
        private void OnServersInit()
        {
            Components = new ShipDockComponentManager
            {
                FrameTimeInScene = (int)(UnityEngine.Time.deltaTime * 1000)
            };

            MethodUpdater updater = ShipDockComponentManagerSetting.isMergeUpdateMode ?
                                    new MethodUpdater
            {
                Update = MergeComponentUpdateMode
            } :
            new MethodUpdater
            {
                Update = SingleFrameComponentUpdateMode
            };
            UpdaterNotice notice = Pooling <UpdaterNotice> .From();

            notice.ParamValue = updater;
            ShipDockConsts.NOTICE_ADD_UPDATE.Broadcast(notice);
            Pooling <UpdaterNotice> .To(notice);

            ShipDockConsts.NOTICE_SCENE_UPDATE_READY.Add(OnSceneUpdateReady);
        }
Exemplo n.º 28
0
 protected override IGameModel GetNewModel()
 {
     return(Pooling <DruggeryModel> .From());
 }
Exemplo n.º 29
0
 protected override IGameModel GetNewModel()
 {
     return(Pooling <BlueprintModel> .From());
 }
Exemplo n.º 30
0
 protected virtual IGameModel GetNewModel()
 {
     return(Pooling <GameModel> .From() as IGameModel);
 }