Ejemplo n.º 1
0
 protected void State_OnChanged(SettingState state)
 {
     CurrentState = state;
     if (OnStateChanged != null)
     {
         OnStateChanged(this);
     }
 }
Ejemplo n.º 2
0
 public void Initialize()
 {
     newState     = EState.none;
     State        = SettingState.Difficulty;
     DiffMode     = (Difficulty)Math.Max(0, GameConstants.iDifficulty - 1);
     volumeterPos = GetVolPos(GameConstants.Volume);
     enterMenu    = false;
     priorVolume  = GameConstants.Volume;
 }
 public void ChangeMenuState(int num)
 {
     if (num >= MenuNum)
     {
         return;
     }
     m_currentState.OnRelease();
     m_currentState = m_selectMenu[num].GetComponent <SettingState>();
     m_currentState.OnStart();
 }
Ejemplo n.º 4
0
 protected override void Initialize()
 {
     mouseState        = Mouse.GetState();
     inventory         = new InventoryState(this, graphics.GraphicsDevice, Content);
     shop              = new ShopState(this, graphics.GraphicsDevice, Content, inventory);
     menu              = new MenuState(this, graphics.GraphicsDevice, Content);
     setting           = new SettingState(this, graphics.GraphicsDevice, Content);
     Game              = new GameState(this, graphics.GraphicsDevice, Content, inventory, mouseState, shop);
     IsMouseVisible    = true;
     IsFixedTimeStep   = true;
     TargetElapsedTime = TimeSpan.FromSeconds(1d / 60d);
     base.Initialize();
 }
Ejemplo n.º 5
0
        private void InitForm()
        {
            this.currentState = settingsRepository.GetSyncState();
            //connect
            ReconnectToolStripMenuItemClick(null, null);

            ShowGrid();

            if (syncTimer == null)
            {
                syncTimer = new System.Threading.Timer(new TimerCallback(TickTimer), null, Timeout.Infinite, Timeout.Infinite);
            }
        }
Ejemplo n.º 6
0
    public static bool IsFirstLoad()
    {
        if (PlayerPrefs.GetInt("firstLoad") == 0)
        {
            // enter default settings
            SettingState.SetSound(true);
            SettingState.SetGraphics("Medium");

            return(true);
        }

        return(false);
    }
Ejemplo n.º 7
0
    // Start is called before the first frame update
    void Start()
    {
        bool playSound = SettingState.GetSound();

        if (!playSound)
        {
            AudioListener.volume = 0;
        }
        else
        {
            AudioListener.volume = 1;
        }
    }
Ejemplo n.º 8
0
    private void DisplaySoundSetting()
    {
        sound = SettingState.GetSound();

        if (sound)
        {
            soundImage.GetComponent <Image>().sprite = soundOnImg;
            AudioListener.volume = 1;
        }
        else
        {
            soundImage.GetComponent <Image>().sprite = soundOffImg;
            AudioListener.volume = 0;
        }
    }
    public void Start()
    {
        foreach (var obj in m_selectMenu)
        {
            m_settingStates.Add(obj.GetComponent <SettingState>());
        }

        foreach (var state in m_settingStates)
        {
            state.Initialize(this);
        }

        m_currentState = m_settingStates[0];
        SetCursor(0);
    }
Ejemplo n.º 10
0
        public void PopState()
        {
            SettingState s = stateStack.Last();

            stateStack.RemoveAt(stateStack.Count - 1);

            this.EnableFlips     = s.EnableFlips;
            this.EnableCollapses = s.EnableCollapses;
            this.EnableSplits    = s.EnableSplits;
            this.EnableSmoothing = s.EnableSmoothing;
            this.MinEdgeLength   = s.MinEdgeLength;
            this.MaxEdgeLength   = s.MaxEdgeLength;
            this.SmoothSpeedT    = s.SmoothSpeedT;
            this.SmoothType      = s.SmoothType;
            this.ProjectionMode  = s.ProjectionMode;
        }
 public void ChangeState <T>()
 {
     foreach (var state in m_settingStates)
     {
         if (state.GetType() != typeof(T))
         {
             continue;
         }
         if (m_currentState)
         {
             m_currentState.OnRelease();
         }
         m_currentState = state;
         m_currentState.OnStart();
     }
 }
Ejemplo n.º 12
0
        public void PushState()
        {
            SettingState s = new SettingState()
            {
                EnableFlips     = this.EnableFlips,
                EnableCollapses = this.EnableCollapses,
                EnableSplits    = this.EnableSplits,
                EnableSmoothing = this.EnableSmoothing,
                MinEdgeLength   = this.MinEdgeLength,
                MaxEdgeLength   = this.MaxEdgeLength,
                SmoothSpeedT    = this.SmoothSpeedT,
                SmoothType      = this.SmoothType,
                ProjectionMode  = this.ProjectionMode
            };

            stateStack.Add(s);
        }
Ejemplo n.º 13
0
    protected void UpdateView(SettingState state)
    {
        switch (state)
        {
        case SettingState.Normal:
            SetNormalView();
            break;

        case SettingState.Hover:
            SetHoverView();
            break;

        case SettingState.Pressed:
            SetPressedView();
            break;
        }
    }
Ejemplo n.º 14
0
        public void UseMap(SettingState mapToAdd)
        {
            removeCurrentMap();
            switch (mapToAdd)
            {
            case SettingState.General:     //General settings
                eyeXHost.Connect(bhavGeneralMap);
                setupGeneralMap();
                currentSelection = SettingState.General;
                break;

            case SettingState.Zoom:     //Zoom settings
                eyeXHost.Connect(bhavZoomMap);
                setupZoomMap();
                currentSelection = SettingState.Zoom;
                break;

            case SettingState.Shortcut:     //Shortcut settings
                eyeXHost.Connect(bhavShortcutMap);
                setupShortcutMap();
                currentSelection = SettingState.Shortcut;
                break;

            case SettingState.Rearrange:     //Rearrange settings
                eyeXHost.Connect(bhavRearrangeMap);
                setupRearrangeMap();
                currentSelection = SettingState.Rearrange;
                break;

            case SettingState.Crosshair:     //Crosshair settings
                eyeXHost.Connect(bhavCrosshairMap);
                setupCrosshairMap();
                currentSelection = SettingState.Crosshair;
                break;

            case SettingState.Confirm:     //Confirm page
                eyeXHost.Connect(bhavConfirmMap);
                setupConfirmMap();
                currentSelection = SettingState.Confirm;
                break;

            default:
                break;
            }
        }
Ejemplo n.º 15
0
        public static void Initialize(Scene scene)
        {
            Scene = scene;

            menuState      = new MenuState();
            settingState   = new SettingState();
            aboutState     = new AboutState();
            overwriteState = new OverwriteState();
            gameState      = new PlayState();
            pauseState     = new PauseState();
            restartState   = new RestartState();
            winningState   = new WinningState();
            winAllState    = new WinAllState();
            exitGameState  = new ExitGameState();
            exitAppState   = new ExitAppState();

            InitializeGame();
        }
Ejemplo n.º 16
0
    /// <summary>
    /// 뷰 모드와 편집 모드 사이의 변경(버튼 그룹 활성화/비활성화).
    /// </summary>
    /// <param name="mode"></param>
    private void SwitchMode(SettingState mode)
    {
        model.State = mode;

        switch (mode)
        {
        case SettingState.ViewMode:
            CancelSelectRoom();
            viewModeObject.SetActive(true);
            editModeObject.SetActive(false);
            nextButton.interactable = true;
            break;

        case SettingState.EditMode:

            ShowAllLabels();
            viewModeObject.SetActive(false);
            editModeObject.SetActive(true);
            nextButton.interactable = false;
            break;

        default:
            break;
        }

        List <Transform> curfloors = model.Room.SelectedRoom == null ? new List <Transform>() : Util.GetChildTransform(model.Room.SelectedRoom.transform);

        foreach (var r in borderParent.GetComponentsInChildren <Renderer>())
        {
            if (mode == SettingState.ViewMode)
            {
                r.material = model.ColorMaterialBlack;
            }
            else
            {
                // 해당 테두리에 속한 바닥이 현재 편집중인 방이 아니면 테두리를 회색으로 적용
                r.material = (curfloors.Exists(x => borders[x.gameObject] == r.transform.parent)) ? model.ColorMaterialBlack : model.ColorMaterialGray;
            }
        }

        CleanSelect();
    }
Ejemplo n.º 17
0
    private void GetGraphicSettings()
    {
        currentGraphicSettings = SettingState.GetGraphics();

        if (currentGraphicSettings == string.Empty || currentGraphicSettings == null)
        {
            currentGraphicSettings = "Medium";
        }

        string[] gNames = QualitySettings.names;

        foreach (string graphicName in gNames)
        {
            graphicNames.Add(graphicName);
        }

        graphicTextObj.GetComponent <Text>().text = currentGraphicSettings;

        // make sure can't go out of bounds with arrows
        // hide if on first / last
    }
Ejemplo n.º 18
0
    public void ChangeGraphics(bool increase)
    {
        int index = graphicNames.IndexOf(currentGraphicSettings);

        if (increase)
        {
            // make sure left arrow is showing
            leftArrow.SetActive(true);

            // increase the graphics
            QualitySettings.SetQualityLevel(index + 1);
            currentGraphicSettings = graphicNames[index + 1];

            // if on the highest
            if (index + 1 == graphicNames.Count - 1)
            {
                // hide the arrow
                rightArrow.SetActive(false);
            }
        }
        else
        {
            // make sure right arrow is now active
            rightArrow.SetActive(true);

            // decrease the graphics
            QualitySettings.SetQualityLevel(index - 1);
            currentGraphicSettings = graphicNames[index - 1];

            // if on the lowest
            if (index - 1 == 0)
            {
                // hide the arrow
                leftArrow.SetActive(false);
            }
        }

        graphicTextObj.GetComponent <Text>().text = currentGraphicSettings;
        SettingState.SetGraphics(currentGraphicSettings);
    }
Ejemplo n.º 19
0
        public void SetSyncState(SettingState state)
        {
            using (var db = new LiteDatabase(connectionstring))
            {
                var col     = GetCollection(db);
                var results = col.Query().Where(x => x.Id.Equals("SyncState")).Limit(1).ToList();
                if (results.Count > 0)
                {
                    var oldstate = results[0];
                    oldstate.Id    = "SyncState";
                    oldstate.CurBH = state.CurBH;
                    oldstate.Diff  = state.Diff;

                    col.Update(oldstate);
                }
                else
                {
                    state.Id = "SyncState";
                    col.Insert(state);
                }
            }
        }
Ejemplo n.º 20
0
 public OnSettingStateChangeArgs(SettingState state)
 {
     RequestState = state;
 }
Ejemplo n.º 21
0
        public void Update(GameTime time)
        {
            if (enterMenu)
            {
                switch (State)
                {
                case SettingState.Difficulty:
                    ptDiff2.isActive  = true;
                    ptCon2.isActive   = false;
                    ptSound2.isActive = false;
                    UpdateDifficulty();
                    break;

                case SettingState.Volume:
                    ptDiff2.isActive  = false;
                    ptCon2.isActive   = false;
                    ptSound2.isActive = true;
                    UpdateVolume();
                    break;

                case SettingState.Controls:
                    ptDiff2.isActive  = false;
                    ptCon2.isActive   = true;
                    ptSound2.isActive = false;
                    UpdateControls();
                    break;

                case SettingState.back:
                    newState = EState.MainMenu;
                    canLeave = true;
                    break;
                }
            }
            else
            {
                ptDiff2.isActive  = false;
                ptCon2.isActive   = false;
                ptSound2.isActive = false;

                if (!ispressed && Keyboard.GetState().IsKeyDown(Keys.Down))
                {
                    State = (SettingState)Math.Min((int)State + 1, 3);
                    UpdateCursor();
                    GameConstants.Switch.Play();
                    ispressed = true;
                }
                if (!ispressed && Keyboard.GetState().IsKeyDown(Keys.Up))
                {
                    State = (SettingState)Math.Max((int)State - 1, 0);
                    UpdateCursor();
                    GameConstants.Switch.Play();
                    ispressed = true;
                }

                if (Keyboard.GetState().IsKeyUp(Keys.Down) && Keyboard.GetState().IsKeyUp(Keys.Up) && Keyboard.GetState().IsKeyUp(Keys.Escape))
                {
                    ispressed = false;
                }

                if (!isEnterDown && Keyboard.GetState().IsKeyDown(Keys.Enter))
                {
                    GameConstants.Select.Play();
                    enterMenu   = true;
                    isEnterDown = true;
                }

                if (Keyboard.GetState().IsKeyUp(Keys.Enter))
                {
                    isEnterDown = false;
                }

                if (!ispressed && Keyboard.GetState().IsKeyDown(Keys.Escape))
                {
                    ispressed = true;
                    newState  = EState.MainMenu;
                    canLeave  = true;
                }
            }
        }
Ejemplo n.º 22
0
        private void WaitForQuit()
        {
            while (true)
            {
                if (js.GetButtonStart())
                {
                    if (quadEnabled)
                    {
                        Console.WriteLine("Disabled");
                        quadEnabled = false;
                        con.SendCommand(new JcRobotNetworking.Command(0, BitConverter.GetBytes((uint)0)));
                    }
                    else
                    {
                        Console.WriteLine("Enabled");
                        quadEnabled = true;
                        con.SendCommand(new JcRobotNetworking.Command(0, BitConverter.GetBytes((uint)1296)));
                    }
                }

                if (js.GetButtonColorLeft())
                {
                    Console.WriteLine("Mode switched to offset");
                    _settingState = SettingState.offset;
                }

                if (js.GetButtonColorBottom())
                {
                    Console.WriteLine("Mode switched to kp");
                    _settingState = SettingState.kp;
                }

                if (js.GetButtonColorRight())
                {
                    Console.WriteLine("Mode switched to kd");
                    _settingState = SettingState.kd;
                }

                if (js.GetButtonColorTop())
                {
                    Console.WriteLine("Mode switched to ki");
                    _settingState = SettingState.ki;
                }

                switch (_settingState)
                {
                case SettingState.offset:
                    if (js.GetHAT().X != 0 || js.GetHAT().Y != 0)
                    {
                        rollOffset  += js.GetHAT().X * 1;
                        pitchOffset += js.GetHAT().Y * 1;
                        Console.WriteLine("Offsets: " + rollOffset + ", " + pitchOffset);
                        con.SendCommand(new JcRobotNetworking.Command(5, BitConverter.GetBytes(rollOffset)));  // roll
                        con.SendCommand(new JcRobotNetworking.Command(6, BitConverter.GetBytes(pitchOffset))); // pitch
                    }
                    break;

                case SettingState.kp:
                    if (js.GetHAT().X != 0 || js.GetHAT().Y != 0)
                    {
                        kp += js.GetHAT().Y * 1;
                        Console.WriteLine("kp: " + kp);
                        con.SendCommand(new JcRobotNetworking.Command(2, BitConverter.GetBytes(kp))); // roll
                    }
                    break;

                case SettingState.kd:
                    if (js.GetHAT().X != 0 || js.GetHAT().Y != 0)
                    {
                        kd += js.GetHAT().Y * .1f;
                        Console.WriteLine("kd: " + kd);
                        con.SendCommand(new JcRobotNetworking.Command(3, BitConverter.GetBytes(kd))); // roll
                    }
                    break;

                case SettingState.ki:
                    if (js.GetHAT().X != 0 || js.GetHAT().Y != 0)
                    {
                        ki += js.GetHAT().Y * .1f;
                        Console.WriteLine("ki: " + ki);
                        con.SendCommand(new JcRobotNetworking.Command(4, BitConverter.GetBytes(ki))); // roll
                    }
                    break;
                }



                Thread.Sleep(200);
            }
        }
Ejemplo n.º 23
0
 public void ClickSound()
 {
     SettingState.SetSound(!sound);
     DisplaySoundSetting();
 }
Ejemplo n.º 24
0
 protected void UpdateState(SettingState state)
 {
     OnSettingStateChange?.Invoke(this, new(state));
 }
Ejemplo n.º 25
0
 public void ResetPlayerPrefs()
 {
     SettingState.ResetPlayerPrefs();
     ResetUI(false);
 }
Ejemplo n.º 26
0
        private void InitMachine()
        {
            Log.Info("InitMachine");
            //  if (saveLoadWinPos == null)
            //     saveLoadWinPos = new SaveLoadWinPos();


            // Create the states

            initial  = new InitialState("Init", _machine);
            settings = new SettingState("Settings", _machine);
            sequence = new SequenceState("Sequence", _machine);
            launch   = new LaunchState("Launch", _machine);
            launched = new LaunchedState("Launched", _machine);
            finish   = new KFSMState("Finish");

            // Add events to the states

            var go2Finish = new KFSMEvent("Finish")
            {
                GoToStateOnEvent = finish,
                updateMode       = KFSMUpdateMode.MANUAL_TRIGGER
            };

            var go2Settings = new KFSMEvent("Settings")
            {
                GoToStateOnEvent = settings, updateMode = KFSMUpdateMode.MANUAL_TRIGGER
            };

            initial.AddEvent(go2Settings);

            var go2Init = new KFSMEvent("Init")
            {
                GoToStateOnEvent = initial, updateMode = KFSMUpdateMode.MANUAL_TRIGGER
            };

            settings.AddEvent(go2Init);
            sequence.AddEvent(go2Init);
            finish.AddEvent(go2Init);

            var go2Sequence = new KFSMEvent("Sequence")
            {
                GoToStateOnEvent = sequence, updateMode = KFSMUpdateMode.MANUAL_TRIGGER
            };

            initial.AddEvent(go2Sequence);

            var go2Launch = new KFSMEvent("Launch")
            {
                GoToStateOnEvent = launch, updateMode = KFSMUpdateMode.MANUAL_TRIGGER
            };

            initial.AddEvent(go2Launch);
            launch.AddEvent(go2Init);
            launch.AddEvent(go2Finish);

            var go2Launched = new KFSMEvent("Launched")
            {
                GoToStateOnEvent = launched, updateMode = KFSMUpdateMode.MANUAL_TRIGGER
            };

            launch.AddEvent(go2Launched);

            initial.AddEvent(go2Finish);
            launched.AddEvent(go2Finish);

            // Add states to the state  machine

            _machine.AddState(initial);
            _machine.AddState(settings);
            _machine.AddState(sequence);
            _machine.AddState(launch);
            _machine.AddState(finish);
        }
Ejemplo n.º 27
0
 public void SetState(SettingState state)
 {
     State = state;
 }
Ejemplo n.º 28
0
 public void SetState(SettingState state)
 {
     State = state;
 }