Esempio n. 1
0
    System.Collections.IEnumerator KeyReg()
    {
        running = true;
        yield return(new WaitUntil(() => Input.GetKeyDown(KeyCode.Minus)));

        StartCoroutine(CheckKey());
        yield return(new WaitUntil(() => returned));

        if (i == int.MaxValue && num < ItemDataManager.s.items.Capacity)
        {
            TGLogger.Log(ItemDataManager.s.items[num].itemName);
            Inventory.s.Add(ItemDataManager.s.items[num]);
            i        = 0;
            num      = 0;
            returned = false;
            running  = false;
            StartCoroutine(KeyReg());
            yield break;
        }
        else
        {
            TGLogger.Log("bad return value, this is bad!");
            yield break;
        }
    }
Esempio n. 2
0
        /// <summary>
        /// Set up a log file.
        ///
        /// Removes log file if it exists
        /// </summary>
        /// <param name="_path">path to file</param>
        private bool _Log(int connectionID, string _path, TGLogger _t)
        {
            // remove log file if it exists
            if (File.Exists(_path))
            {
                File.Delete(_path);
            }

            // start the log
            int errCode = _t(connectionID, _path);

            // check for errors
            bool success = false;

            switch (errCode)
            {
            case -1:
                lstBoxLog.Items.Add("ERROR: connectionId does not refer to a valid ThinkGear Connection ID handle in " + _t.Method.Name);
                break;

            case -2:
                lstBoxLog.Items.Add("ERROR: could not open file " + _path + " in logger " + _t.Method.Name);
                break;

            default:
                success = true;
                break;
            }

            return(success);
        }
Esempio n. 3
0
 void List()
 {
     TGLogger.Log("Refreshing item list!");
     foreach (ItemSO I in ItemDataManager.s.items)
     {
         TGLogger.Log(ItemDataManager.s.items.IndexOf(I).ToString() + " " + I.itemName);
     }
 }
Esempio n. 4
0
 private void Start()
 {
     if (GameObject.Find("godmode"))
     {
         Destroy(gameObject);
         return;
     }
     gameObject.name = "godmode";
     TGLogger.Log("GODMODE HAS INSTANTIATED");
 }
Esempio n. 5
0
 void Awake()
 {
     if (GameObject.Find("ID"))
     {
         Destroy(gameObject);
         return;
     }
     gameObject.name = "ID";
     TGLogger.Log("Instanced ItemDebug!");
 }
Esempio n. 6
0
File: Game.cs Progetto: TomasMike/TG
        public void DuringDay()
        {
            // if all passed go to end of day
            if (playersWhoPassedThisDay.Count == Players.Count)
            {
                TGLogger.LogToConsole("All players passed. Jumping to end of day phase.");
                EndOfDay();
            }
            else
            {
                Round++;

                if (Players.Count > 1)
                {
                    // ries kto bol toto kolo, ked vsetci zacni dalsie kolo a kto passol uz
                    var possiblePlayersToBeActivePlayer = Players.Select(_ => _.PlayerNumber).ToList();
                    possiblePlayersToBeActivePlayer.RemoveAll(_ => playersWhoActedThisRound.Contains(_));
                    possiblePlayersToBeActivePlayer.RemoveAll(_ => playersWhoPassedThisDay.Contains(_));

                    if (possiblePlayersToBeActivePlayer.Count == 0)
                    {
                        //next round
                        playersWhoActedThisRound.Clear();
                        TGLogger.LogToConsole("All players who didnt pass, acted this round. Next round starts.");
                        DuringDay();
                        return;
                    }
                    else if (possiblePlayersToBeActivePlayer.Count == 1)
                    {
                        Instance.ActivePlayerNumber = possiblePlayersToBeActivePlayer[0];
                        TGLogger.LogToConsole($"{Instance.ActivePlayerNumber} is the last player who didnt act this round, hes the active player now.");
                    }
                    else
                    {
                        Instance.ActivePlayerNumber =
                            Asker.Ask(
                                "Who will be next active player?",
                                possiblePlayersToBeActivePlayer.Select(_ => new Option <PlayerNumber>(_))).InnerOption;
                    }
                    //
                }
                else
                {
                    //singleplayer
                    Instance.ActivePlayerNumber = PlayerNumber.Player1;
                    //MessageBox.Show("SinglePlayer");
                }
                _MainForm.Instance.Text = $"Active Player:{Instance.ActivePlayer.Name}";
                StartNextPlayerTurn();
            }
        }
Esempio n. 7
0
 private void Awake()
 {
     TGLogger.Log("Now Preventing Staff");
     StartCoroutine(awaitSS());
 }
        /// <summary>
        /// Set up a log file.
        /// 
        /// Removes log file if it exists
        /// </summary>
        /// <param name="_path">path to file</param>
        private bool _Log(int connectionID, string _path, TGLogger _t)
        {
            // remove log file if it exists
            if (File.Exists(_path))
                File.Delete(_path);

            // start the log
            int errCode = _t(connectionID, _path);

            // check for errors
            bool success = false;
            switch (errCode)
            {
                case -1:
                    lstBoxLog.Items.Add("ERROR: connectionId does not refer to a valid ThinkGear Connection ID handle in " + _t.Method.Name);
                    break;
                case -2:
                    lstBoxLog.Items.Add("ERROR: could not open file " + _path + " in logger " + _t.Method.Name);
                    break;
                default:
                    success = true;
                    break;
            }

            return (success);
        }
Esempio n. 9
0
File: Game.cs Progetto: TomasMike/TG
 public void StartNextPlayerTurn()
 {
     TGLogger.LogToConsole($"ACTIVE PLAYER:{Instance.ActivePlayerNumber}");
     playersWhoActedThisRound.Add(Instance.ActivePlayerNumber);
 }