Exemplo n.º 1
0
 void MasterStateMachine(MasterState _curState)
 {
     switch (_curState) {
     case MasterState.WAITING:
         // Waiting to Load level
         break;
     case MasterState.LOADING:
         // Loading a Level
         // If level has been loaded, state is Start
         break;
     case MasterState.START:
         // Initialize a level
         // If all units and map have been initialized, state is Continue
         break;
     case MasterState.PAUSED:
         // Pause the game
         break;
     case MasterState.CONTINUE:
         // Level has been initialized, run Time as normal
         break;
     default:
         _mState = MasterState.WAITING;
         break;
     }
 }
Exemplo n.º 2
0
        public void     ResetState()
        {
            this.masterState = MasterState.Same;

            for (int i = 0; i < this.children.Count; i++)
            {
                this.children[i].ResetState();
            }
        }
Exemplo n.º 3
0
 public File(File parent, string path, string name, bool isMaster, bool isDir, InitialState initialState, MasterState masterState)
 {
     this.parent       = parent;
     this.path         = path.Replace('\\', '/');
     this.name         = Path.GetFileName(path);
     this.isDir        = isDir;
     this.initialState = initialState;
     this.masterState  = masterState;
     this.isMaster     = isMaster;
     this.initialHash  = isDir == false?NGSyncFoldersWindow.TryGetCachedHash(this.path) : string.Empty;
 }
Exemplo n.º 4
0
        public void     Delete()
        {
            InternalNGDebug.InternalLogFormat("Deleting {0} {1}", this.path, this.initialState);

            if (this.isMaster == true)
            {
                this.masterState = MasterState.Deleted;
            }
            else
            {
                this.slaveState = SlaveState.NonExist;
            }

            if (this.initialState == InitialState.New)
            {
                this.parent.children.Remove(this);
            }

            this.InvalidateHeight();
        }
Exemplo n.º 5
0
        public void AddState(AddStateViewModel model)
        {
            try
            {
                if (model != null)
                {
                    MasterState entity = new MasterState();
                    entity.StateName    = model.StateName;
                    entity.CountryRowID = model.CountryRowID;

                    db.MasterStates.Add(entity);
                }
                else
                {
                    throw new Exception("State could not be blank!");
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 6
0
        public File     Generate(string path)
        {
            this.InvalidateHeight();

            if (this.path == path)
            {
                string hash = NGSyncFoldersWindow.TryGetCachedHash(path);

                if (this.isMaster == true)
                {
                    if (hash == this.initialHash)
                    {
                        this.masterState = MasterState.Same;
                    }
                    else
                    {
                        this.masterState = MasterState.Altered;
                    }
                }
                else
                {
                    this.initialHash = hash;
                    this.slaveState  = SlaveState.Exist;
                }

                this.targetHash = hash;

                return(this);
            }

            string oldPath = path.Substring(0, this.path.Length + 1);

            string[] newPath = path.Substring(this.path.Length + 1).Split(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
            File     parent  = this;

            path = this.path;

            for (int i = 0; i < newPath.Length; i++)
            {
                oldPath = Path.Combine(oldPath, newPath[i]);
                path    = Path.Combine(path, newPath[i]);

                File child = null;

                for (int j = 0; j < parent.children.Count; j++)
                {
                    if (parent.children[j].path == path)
                    {
                        child = parent.children[j];
                        break;
                    }
                }

                if (child == null)
                {
                    InternalNGDebug.InternalLogFormat("Generating {0} in {1} ({2})", path, parent, oldPath);
                    if (this.isMaster == true)
                    {
                        child = new File(parent, path, Path.GetFileName(path), true, Directory.Exists(oldPath), InitialState.New, MasterState.Created);
                    }
                    else
                    {
                        child = new File(parent, path, Path.GetFileName(path), false, Directory.Exists(oldPath), InitialState.New, System.IO.File.Exists(path) ? SlaveState.Exist : SlaveState.NonExist);
                    }
                    parent.children.Add(child);
                    parent.children.Sort((a, b) => string.CompareOrdinal(a.path, b.path));
                }

                parent = child;
            }

            return(parent);
        }
Exemplo n.º 7
0
 public List <MasterState> GetState(MasterState masterState)
 {
     return(new ITCircleDAO.ApplicationDAO().GetState(masterState));
 }
Exemplo n.º 8
0
 public void UnPause()
 {
     _mState = MasterState.CONTINUE;
     Debug.Log ("Master State is: " + _mState.ToString() +" Continuing game! ");
     Time.timeScale = 1;
 }
Exemplo n.º 9
0
    void Awake()
    {
        Instance = this;

        // ON PLANET:
        if (SceneManager.GetActiveScene().name == "Level_Planet")
        {
            // If for some reason the mission failed panel is still active, deactivate it
            if (missionFailedPanel)
            {
                if (missionFailedPanel.activeSelf)
                    missionFailedPanel.SetActive(false);
            }
            mState = MasterState.START;
        }
        else if (SceneManager.GetActiveScene().name == "Level_CENTRAL")
        {
            _mState = MasterState.ONSHIP;
        }
    }
Exemplo n.º 10
0
 public void TestPause()
 {
     _mState = MasterState.PAUSED;
     Debug.Log ("Master State is: " + _mState.ToString() +" Pausing game! ");
     Time.timeScale = 0;
 }
Exemplo n.º 11
0
 public void ReturnToShip()
 {
     _mState = MasterState.ONSHIP;
     game_master.NewGameLoadShip ();
 }
Exemplo n.º 12
0
 public void QuitGame()
 {
     mState = MasterState.QUIT;
 }
Exemplo n.º 13
0
 public void NewCharacter()
 {
     _mState = MasterState.ONSHIP;
     game_master.NewCharacterScreen();
 }
Exemplo n.º 14
0
    void MissionSuccess()
    {
        //if (Time.timeScale != 0)
        //{
        //    UI_Manager.Instance.DisplayVictoryPanel();

        //    StopAllCoroutines();

        //    Time.timeScale = 0;
        //}
        UI_Manager.Instance.DisplayVictoryPanel();

        // Notify the Launchpad/Transporter that it can now launch safely by unlocking its controls.
           // Transporter_Handler.instance.LockControls(false);

        Debug.Log("MASTER STATE: Unlocking Transporter controls!");

        mState = MasterState.WAITING;
    }
Exemplo n.º 15
0
 void MasterStateMachine(MasterState _curState)
 {
     switch (_curState) {
     case MasterState.WAITING:
         // Waiting to Load level
         break;
     case MasterState.LOADING:
         // Loading a Level
         // If level has been loaded, state is Start
         break;
     case MasterState.START:
         // Initialize a level
         // If all units and map have been initialized, state is Continue
         break;
     case MasterState.PAUSED:
         // Pause the game
         break;
     case MasterState.CONTINUE:
         // Level has been initialized, run Time as normal
         break;
     case MasterState.MISSION_FAILED:
         // Pause game and tell GameMaster to load level or go back to ship level
         MissionFailed();
         break;
     case MasterState.PLAYER_DEAD:
         // Pause game and tell GameMaster to load level or go back to ship level
         MissionFailed();
         break;
     case MasterState.MISSION_SUCCESS:
             // Load a progress scene where the player sees what items they got and what they have left
             MissionSuccess();
         break;
     case MasterState.ONSHIP:
             if (Time.timeScale == 0)
             {
                 Time.timeScale = 1;
             }
         break;
         case MasterState.QUIT:
         //TODO: Here we would begin the save progress function and then quit the application
         Application.Quit();
         break;
     default:
         _mState = MasterState.WAITING;
         break;
     }
 }