コード例 #1
0
    public void StartAnalysis()
    {
        try
        {
            if (game != null && !overwriteGameData)
            {
                gOBtnStart.SetActive(false);
                gOBtnPause.SetActive(true);
                createGamePanel.SetActive(false);
                mainTable.GetComponent <CanvasGroup>().blocksRaycasts = false;

                frequences.alpha           = 1;
                graphicalMethod.alpha      = 1;
                btnGameSelect.interactable = false;

                executive = game.Executive();
                StartCoroutine(executive);
            }
            else if (overwriteGameData)
            {
                sbyte[,] matrix = new sbyte[GameTheory.Game.gameData.rowStrategies.Count, GameTheory.Game.gameData.columnStrategies.Count];

                byte id = 0;
                for (byte i = 0; i < matrix.GetLength(0); i++)
                {
                    for (byte j = 0; j < matrix.GetLength(1); j++)
                    {
                        string value = TableManager.ins.mainTable.GetChild(id).GetComponent <InputField>().text;

                        if (string.IsNullOrEmpty(value))
                        {
                            throw new FormatException("Pusta wartość w tabeli wypłat");
                        }
                        else
                        {
                            matrix[i, j] = sbyte.Parse(value);
                            id++;
                        }
                    }
                }

                GameData gD = new GameData(GameTheory.Game.gameData, matrix);
                game = new GameTheory.Game(gD);

                overwriteGameData = false;
                StartAnalysis();
            }
            else
            {
                LogsManager.ins.AddLog("Nie można rozpocząc pustej gry", EColors.Red);
            }
        }
        catch (Exception e)
        {
            LogsManager.ins.AddLog(e.Message, EColors.Red);
        }
    }
コード例 #2
0
    public void CreateGame()
    {
        LogsManager.ins.ClearLogs();
        EndAnalysis();

        string rowPlayerName = rowPlayerField.text;
        string colPlayerName = colPlayerField.text;

        byte rowStrategiesCount = byte.Parse(rowPlayerStrategiesTxt.text);
        byte colStrategiesCount = byte.Parse(colPlayerStrategiesTxt.text);

        GameData gD = new GameData(rowPlayerName, colPlayerName, rowStrategiesCount, colStrategiesCount);

        game = new GameTheory.Game(gD);
    }
コード例 #3
0
 public void LoadGame(string xmlFileName)
 {
     LogsManager.ins.ClearLogs();
     game = new GameTheory.Game(XMLManager.ins.LoadData(xmlFileName));
 }