예제 #1
0
        private void OnStateChange(State state)
        {
            StateChangeHandler handler = StateChange;

            if (handler != null)
            {
                handler(state);
            }
        }
예제 #2
0
        private void OnStateChange(State state)
        {
            state = DeFrobApiBreak(state);
            StateChangeHandler handler = StateChange;

            if (handler != null)
            {
                handler(state);
            }
        }
예제 #3
0
        virtual protected void InitMember()
        {
            m_StopPrivilege = new System.Threading.ReaderWriterLock();
            m_OMCAddresses  = new Dictionary <string, string>();
            m_OMCInfo       = new Dictionary <string, string>();
            LogReceived    += new LogHandler(DBAdapterBase_LogReceived);
            StateChanged   += new StateChangeHandler(DBAdapterBase_StateChanged);

            m_TimerMaintenance          = new System.Timers.Timer(3540 * 1000); // 59分钟运行一次的维护定时器
            m_TimerMaintenance.Elapsed += new System.Timers.ElapsedEventHandler(m_TimerMaintenance_Elapsed);
        }
        /// <summary>
        /// Registers a handler to be called when state changes. The first handler added that matches
        ///     will be the first handler to be called, but will not block any other handlers
        /// </summary>
        /// <param name="initialState">The possible initial state, or states if the enum is flags</param>
        /// <param name="endState">the possible end state, or states if the enum is flags</param>
        /// <param name="handler">the handler to execute</param>
        /// <param name="isStateEntry">Whether or not this represents an entry into a state, or an exit from a state.
        ///     All state handlers which represent a state Exit will run before any which represent a state Entry</param>
        public void registerStateTransitionHandler(T initialState, T endState, Action <ParamType> handler, StateChangeExecutionOrder executionOrder)
        {
            var newHandler = new StateChangeHandler
            {
                fromState      = initialState,
                toState        = endState,
                handler        = handler,
                executionOrder = executionOrder
            };

            stateChangeHandlers = stateChangeHandlers.Append(newHandler);
        }
예제 #5
0
        /// <summary>
        /// Hides the slideout navigation menu.
        /// </summary>
        public void CloseMenu(bool animate = true)
        {
            if (!IsOpen)
            {
                return;
            }
            MenuAreaController.View.EndEditing(true);
            var view = _contentAreaView;

                        #if __UNIFIED__
            Action animation;
            Action finished;
                        #else
            NSAction animation;
            NSAction finished;
                        #endif
            animation = () => {
                view.Frame = new RectangleF(0, 0, view.Frame.Width, view.Frame.Height);
                MenuAreaController.View.Frame = new RectangleF(-MenuWidth, 0, MenuAreaController.View.Frame.Width, MenuAreaController.View.Frame.Height);
                _shadownOverlayContent.Alpha  = 0.0f;
                _shadownOverlayMenu.Alpha     = 1.0f;
            };
//			Action animationSh = () => { };
//			animationSh ();
            finished = () => {
                if (view.Subviews.Length > 0)
                {
                    view.Subviews[0].UserInteractionEnabled = true;
                }
                view.RemoveGestureRecognizer(_tapGesture);
                _isOpen = false;
                if (StateChangeHandler != null)
                {
                    StateChangeHandler.Invoke(this, _isOpen);
                }
            };
            if (animate)
            {
                UIView.Animate(_slideSpeed, 0, UIViewAnimationOptions.CurveEaseInOut, animation, finished);
            }
            else
            {
                // fire the animation results manually
                animation();
                finished();
            }
            HideShadow();
        }
예제 #6
0
        /// <summary>
        /// Contructor.
        /// </summary>
        /// <param name="rootViewController">
        /// The view controller that the Sidebar is being added to.
        /// </param>
        /// <param name="contentViewController">
        /// The view controller for the content area.
        /// </param>
        /// <param name="navigationViewController">
        /// The view controller for the side menu.
        /// </param>
        public SidebarController(
            UIViewController rootViewController,
            UIViewController contentViewController,
            UIViewController menuViewController)
        {
            _sidebar = new Sidebar(rootViewController, contentViewController, menuViewController);

            _sidebar.StateChangeHandler += (sender, e) => {
                if (StateChangeHandler != null)
                {
                    StateChangeHandler.Invoke(sender, e);
                }
            };

            ChangeMenuView(menuViewController);
            ChangeContentView(contentViewController);

            AttachSidebarControllerToRootController(rootViewController);
        }
예제 #7
0
        /// <summary>
        /// Shows the slideout navigation menu.
        /// </summary>
        public void OpenMenu()
        {
            if (IsOpen)
            {
                return;
            }
            ShowShadow(5);
            var view = _contentAreaView;

            view.EndEditing(true);

            UIView.Animate(
                _slideSpeed,
                0,
                UIViewAnimationOptions.CurveEaseInOut,
                () => {
                _shadownOverlayContent.Alpha = 0.7f;
                _shadownOverlayMenu.Alpha    = 0.0f;

                if (MenuLocation == MenuLocations.Right)
                {
                    view.Frame = new RectangleF(-MenuWidth, 0, view.Frame.Width, view.Frame.Height);
                }
                else if (MenuLocation == MenuLocations.Left)
                {
                    view.Frame = new RectangleF(MenuWidth, 0, view.Frame.Width, view.Frame.Height);
                    MenuAreaController.View.Frame = new RectangleF(0, 0, MenuAreaController.View.Frame.Width, MenuAreaController.View.Frame.Height);
                }
            },
                () => {
                if (view.Subviews.Length > 0)
                {
                    view.Subviews[0].UserInteractionEnabled = false;
                }
                view.AddGestureRecognizer(_tapGesture);
                _isOpen = true;
                if (StateChangeHandler != null)
                {
                    StateChangeHandler.Invoke(this, _isOpen);
                }
            });
        }
예제 #8
0
    public void SwtichMap(ulong areaId, Vector3 worldPos)
    {
        StateChangeHandler.HandleChangeState();
        DropHandler.HandleSyncDrop();
        SkillBroadCastRPCNet.Handle();

        LoadingPanelParamere loadingPanelParamere = MessageSingleton.Get <LoadingPanelParamere>();

        loadingPanelParamere.OnShown = () =>
        {
            GameplayProxy gameplayProxy = GameFacade.Instance.RetrieveProxy(ProxyName.GameplayProxy) as GameplayProxy;
            if (gameplayProxy != null)
            {
                GameplayManager.Instance.Clear();
                gameplayProxy.SetCurrentAreaUid(areaId);
                Vector3 gameWorldPos = gameplayProxy.WorldPositionToServerAreaOffsetPosition(worldPos);
                Map.MapManager.GetInstance().SetPlayerPosition(worldPos, gameWorldPos);
            }
            OnSwitchMapLoadingPanelShown();
        };
        UIManager.Instance.OpenPanel(UIPanel.LoadingSecondPanel, loadingPanelParamere);

        CfgEternityProxy cfgEternityProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy;
        uint             lastGamingMapId  = cfgEternityProxy.GetLastGamingMapId();
        uint             gamingMapId      = cfgEternityProxy.GetCurrentGamingMapId();

        if (lastGamingMapId != Map.Constants.NOTSET_MAP_UID)
        {
            int lastMapType = cfgEternityProxy.GetMapByKey(lastGamingMapId).Value.GamingType;
            int mapType     = cfgEternityProxy.GetMapByKey(gamingMapId).Value.GamingType;
            if (lastMapType == 4 && mapType == 4)
            {
                WwiseUtil.PlaySound(WwiseManager.voiceComboID, WwiseMusicSpecialType.SpecialType_Voice_StartCrossingTheGate, WwiseMusicPalce.Palce_1st, false, null);
            }
        }
    }
예제 #9
0
 public void AddOnChange(StateChangeHandler func)
 {
     stateChangeEvent += func;
 }
예제 #10
0
 internal void SetIdAndListener(int id, StateChangeHandler stateListener)
 {
     this.id            = id;
     this.stateListener = stateListener;
 }
예제 #11
0
 /// <param name="reportCompletion">Fired when an action finishes, be it due to cancelation or natural completion</param>
 /// <param name="stateChanged">Fired when an action starts and when it finishes</param>
 public CancellableActionRunner(CompletionHandler reportCompletion, StateChangeHandler stateChanged)
 {
     this.reportCompletion = reportCompletion ?? throw new ArgumentNullException(nameof(reportCompletion));
     this.stateChanged     = stateChanged ?? throw new ArgumentNullException(nameof(stateChanged));
 }
예제 #12
0
        protected override void Initialize()
        {
            gameState = GameState.Menu; //set the initial gamestate

            Camera.Initialize( //initialize the camera
                DEFAULT_WINDOWED_WIDTH,
                DEFAULT_WINDOWED_HEIGHT,
                LevelManager.Levels[0].WorldSizeX,
                LevelManager.Levels[0].WorldSizeY);

            Camera.Position = Vector2.Zero;

            GameUI = new Dictionary<string, UIBase>();
            MenuUI = new Dictionary<string, UIBase>();
            UpgradeUI = new Dictionary<string, UIBase>();
            HelpUI = new Dictionary<string, UIBase>();

            OnStateChange += new StateChangeHandler(handleSwitching);

            base.Initialize();
        }
예제 #13
0
 internal void SetIdAndListener(int id, StateChangeHandler stateListener)
 {
     this.id = id;
     this.stateListener = stateListener;
 }