示例#1
0
        public static void SetupDelayed()
        {
            if (setupDone != SetupPhase.Unstarted)
            {
                return;
            }

            if (!ApplicationUtility.IsReady())
            {
                EditorApplication.delayCall += SetupDelayed;
                return;
            }

            // TypeExtensions is currently needed for popupmenu generation
            if (!TypeExtensions.IsReady)
            {
                EditorApplication.delayCall += SetupDelayed;
                return;
            }

            setupDone = SetupPhase.InProgress;

            // Make sure that Preferences have been fetched via AssetDatabase.LoadAssetAtPath before moving on to threaded code
            var preferences = InspectorUtility.Preferences;

            UnityEngine.Debug.Assert(preferences != null);

            // build syntax formatting on another thread to avoid UI slow downs when user
            // selects a large formatted text file
            ThreadPool.QueueUserWorkItem(SetupThreaded);
        }
示例#2
0
 private static void StartGame()
 {
     RoundCounter = 0;
     GameIsEnded  = false;
     CurrentPhase = new SetupPhase();
     UI.AddTestLogEntry("Game is started");
     CurrentPhase.StartPhase();
 }
示例#3
0
    private static void StartGame()
    {
        RoundCounter = 0;
        GameIsEnded  = false;
        CurrentPhase = new SetupPhase();

        Events.CallGameStartTrigger(CurrentPhase.StartPhase);
    }
示例#4
0
    // PHASES CONTROL

    public static void StartPhases()
    {
        Game = GameObject.Find("GameManager").GetComponent <GameManagerScript>();

        CurrentPhase = new SetupPhase();
        Game.UI.AddTestLogEntry("Game is started");
        CurrentPhase.StartPhase();
    }
示例#5
0
    void Awake()
    {
        playerTurn       = this.GetComponent <PlayerTurn> ();
        setupPhase       = this.GetComponent <SetupPhase> ();
        allocateSoldiers = this.GetComponent <AllocateSoldiers> ();

        territories = GameObject.Find("Territories");
        boardSetUp  = territories.GetComponent <BoardSetUp> ();
    }
示例#6
0
    private static void StartGame()
    {
        RoundCounter = 0;
        GameIsEnded  = false;
        CurrentPhase = new SetupPhase();

        DebugManager.ErrorIsAlreadyReported = false;

        Events.CallGameStartTrigger(CurrentPhase.StartPhase);
    }
示例#7
0
    void Start()
    {
        stateMachine = GetComponent <StateMachine>();
        setupPhase   = GetComponent <SetupPhase>();
        enemyPhase   = GetComponent <EnemyPhase>();
        buildPhase   = GetComponent <IntermissionPhase>();

        patioHealth            = GameObject.FindGameObjectWithTag("Patio").GetComponent <Health>();
        player                 = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>();
        stateMachine.nextPhase = setupPhase; //set the default phase
        musicPlayer            = GetComponent <AudioSource>();
    }
示例#8
0
        //Mainly used for testing purposes
        //Can change input.txt once the function promts user input for a command
        static void Main(string[] args)
        {
            String input; String userInput; String[] name;

            SetupPhase.startPhase();
            while (false)
            {
                Console.WriteLine("Please enter the specified test commad.\n0 - Only print names of winners from input.txt\n" +
                                  "1 - Print all info from players\n2 - Check if the winners match the specified name(Only input one name)\nend - closes program");
                userInput = Console.ReadLine();
                input     = System.IO.File.ReadAllText(@".\input.txt");
                if (userInput == "0")
                {
                    name = findPokerWinner(input);
                    foreach (string player in name)
                    {
                        Console.WriteLine(player);
                    }
                }
                else if (userInput == "1")
                {
                    printResults = true;
                    name         = findPokerWinner(input);
                    printResults = false;
                    foreach (string player in name)
                    {
                        Console.WriteLine(player);
                    }
                }
                else if (userInput == "2")
                {
                    Console.WriteLine("Please write the name of the winner.");
                    userInput = Console.ReadLine();
                    name      = findPokerWinner(input);
                    if (name[0] == userInput)
                    {
                        Console.WriteLine(userInput + " is the correct winner\n");
                    }
                    else
                    {
                        Console.WriteLine("{0} is not the correct winner, {1} is the winner\n", userInput, name[0]);
                    }
                }
                else if (userInput == "end")
                {
                    break;
                }
                else
                {
                    Console.WriteLine("Unkown command. Please use a valid command\n");
                }
            }
        }
示例#9
0
    // Set up array of player colours
    void Awake()
    {
        deploySoldiers   = this.GetComponent <DeploySoldiers> ();
        phases           = this.GetComponent <Phases> ();
        starterPhase     = this.GetComponent <StarterPhase> ();
        setupPhase       = this.GetComponent <SetupPhase> ();
        allocateSoldiers = this.GetComponent <AllocateSoldiers> ();

        territories    = GameObject.FindGameObjectWithTag("Territories");
        continentBonus = territories.GetComponent <ContinentBonus> ();
        changeCategory = territories.GetComponent <ChangeCatagory> ();
        boardSetUp     = territories.GetComponent <BoardSetUp> ();

        GUI              = GameObject.FindGameObjectWithTag("GUI");
        lockoutPlayer    = GUI.GetComponent <LockoutPlayer> ();
        displayTurn      = GUI.GetComponent <DisplayTurn> ();
        gameInstructions = GUI.GetComponent <GameInstructions> ();
    }
示例#10
0
        private static void SetupThreaded(object threadTaskId)
        {
                        #if DEV_MODE
            var timer = new ExecutionTimeLogger();
            timer.Start("MemberInfoBaseDrawerData.SetupThreaded");
            timer.StartInterval("Generate PopupMenuItems");
                        #endif

            var sb = new System.Text.StringBuilder();
            foreach (var type in TypeExtensions.AllVisibleAndUniqueTypes)
            {
                sb.Append(TypeExtensions.GetPopupMenuLabel(type, ""));
                sb.Append('/');
                string typePrefix = sb.ToString();
                sb.Length = 0;

                var fields = type.GetFields(BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly);
                for (int f = fields.Length - 1; f >= 0; f--)
                {
                    var field = fields[f];
                    sb.Append(typePrefix);
                    sb.Append(field.Name);
                    string menuPath = sb.ToString();
                    sb.Length = 0;
                    PopupMenuUtility.BuildPopupMenuItemWithLabel(ref fieldRootItems, ref fieldGroupsByLabel, ref fieldItemsByLabel, field, menuPath, MenuItemValueType.Undefined);
                }

                var properties = type.GetProperties(BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly);
                for (int p = properties.Length - 1; p >= 0; p--)
                {
                    var property = properties[p];
                    sb.Append(typePrefix);
                    StringUtils.ToString(property, sb);

                    string menuPath = sb.ToString();
                    sb.Length = 0;
                    PopupMenuUtility.BuildPopupMenuItemWithLabel(ref propertyRootItems, ref propertyGroupsByLabel, ref propertyItemsByLabel, property, menuPath, MenuItemValueType.Undefined);
                }

                var methods = type.GetMethods(BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly);

                for (int m = methods.Length - 1; m >= 0; m--)
                {
                    var method = methods[m];

                    sb.Append(typePrefix);
                    StringUtils.ToString(method, sb);
                    string menuPath = sb.ToString();
                    sb.Length = 0;

                    PopupMenuUtility.BuildPopupMenuItemWithLabel(ref methodRootItems, ref methodGroupsByLabel, ref methodItemsByLabel, method, menuPath, MenuItemValueType.Undefined);
                }
            }

                        #if DEV_MODE
            timer.FinishInterval();
            timer.StartInterval("allRootItems.AddRange(fieldRootItems)");
                        #endif

            allRootItems.AddRange(fieldRootItems);

                        #if DEV_MODE
            timer.FinishInterval();
            timer.StartInterval("AddRange(allRootItems, propertyRootItems)");
                        #endif

            PopupMenuUtility.AddRange(ref allRootItems, propertyRootItems);

                        #if DEV_MODE
            timer.FinishInterval();
            timer.StartInterval("AddRange(allRootItems, methodRootItems)");
                        #endif

            PopupMenuUtility.AddRange(ref allRootItems, methodRootItems);

                        #if DEV_MODE
            timer.FinishInterval();
            timer.StartInterval("AddRange(allGroupsByLabel, fieldGroupsByLabel)");
                        #endif

            PopupMenuUtility.AddRange(ref allGroupsByLabel, fieldGroupsByLabel);

                        #if DEV_MODE
            timer.FinishInterval();
            timer.StartInterval("AddRange(allGroupsByLabel, propertyGroupsByLabel)");
                        #endif

            PopupMenuUtility.AddRange(ref allGroupsByLabel, propertyGroupsByLabel);

                        #if DEV_MODE
            timer.FinishInterval();
            timer.StartInterval("AddRange(allGroupsByLabel, methodGroupsByLabel)");
                        #endif

            PopupMenuUtility.AddRange(ref allGroupsByLabel, methodGroupsByLabel);

                        #if DEV_MODE
            timer.FinishInterval();
            timer.StartInterval("AddRange(allItemsByLabel, fieldItemsByLabel)");
                        #endif

            PopupMenuUtility.AddRange(ref allItemsByLabel, fieldItemsByLabel);

                        #if DEV_MODE
            timer.FinishInterval();
            timer.StartInterval("AddRange(allItemsByLabel, propertyItemsByLabel)");
                        #endif

            PopupMenuUtility.AddRange(ref allItemsByLabel, propertyItemsByLabel);

                        #if DEV_MODE
            timer.FinishInterval();
            timer.StartInterval("AddRange(allItemsByLabel, methodItemsByLabel)");
                        #endif

            PopupMenuUtility.AddRange(ref allItemsByLabel, methodItemsByLabel);

                        #if DEV_MODE
            timer.FinishInterval();
            timer.FinishAndLogResults();
                        #endif

            setupDone = SetupPhase.Done;

            lock (threadLock)
            {
                var action = onSetupFinished;
                if (action != null)
                {
                    onSetupFinished = null;
                    action();
                }
            }
        }