Пример #1
0
    // Unity fires off this function
    void Start()
    {
        // Find the common objects we use.  These are created by unity.
        cc            = GameObject.FindObjectOfType <CameraController>();
        uICanvas      = GameObject.Find("UICanvas").GetComponent <Canvas>();
        boardCanvas   = GameObject.Find("BoardCanvas").GetComponent <Canvas>();
        tokenCanvas   = GameObject.Find("TokenCanvas").GetComponent <Canvas>();
        tokenBoard    = GameObject.FindObjectOfType <TokenBoard>();
        heroCanvas    = GameObject.FindObjectOfType <HeroCanvas>();
        monsterCanvas = GameObject.FindObjectOfType <MonsterCanvas>();

        // Create some things
        uiScaler = new UIScaler(uICanvas);
        config   = new ConfigFile();
        GameObject go = new GameObject("audio");

        audioControl = go.AddComponent <Audio>();

        if (config.data.Get("UserConfig") == null)
        {
            // English is the default current language
            config.data.Add("UserConfig", "currentLang", DictionaryI18n.DEFAULT_LANG);
            config.Save();
        }
        currentLang = config.data.Get("UserConfig", "currentLang");

        try
        {
            TextAsset localizationFile = Resources.Load("Text/Localization") as TextAsset;
            LocalizationRead.valkyrieDict = LocalizationRead.ReadFromTextAsset(localizationFile, currentLang);
            LocalizationRead.valkyrieDict.setCurrentLanguage(currentLang);
        }
        catch (System.Exception e)
        {
            ValkyrieDebug.Log("Error loading valkyrie localization file:" + e.Message);
        }

        roundControl = new RoundController();

        // Read the version and add it to the log
        TextAsset versionFile = Resources.Load("version") as TextAsset;

        version = versionFile.text.Trim();
        // The newline at the end stops the stack trace appearing in the log
        ValkyrieDebug.Log("Valkyrie Version: " + version + System.Environment.NewLine);

        // Bring up the Game selector
        new GameSelectionScreen();
    }