Ejemplo n.º 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();
        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
        Debug.Log("Valkyrie Version: " + version + System.Environment.NewLine);

        // Bring up the Game selector
        new GameSelection();
    }
Ejemplo n.º 2
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();
    }
Ejemplo n.º 3
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>();
        updateList   = new List <IUpdateListener>();

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

        DictionaryI18n valDict = new DictionaryI18n();

        foreach (string file in System.IO.Directory.GetFiles(Application.streamingAssetsPath + "/text", "Localization*.txt"))
        {
            valDict.AddDataFromFile(file);
        }
        LocalizationRead.AddDictionary("val", valDict);

        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
        gameSelect = new GameSelectionScreen();
    }
Ejemplo n.º 4
0
    // Unity fires off this function
    void Start()
    {
        // Find the common objects we use.  These are created by unity.
        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
        eventList = new Stack <QuestData.Event>();
        uiScaler  = new UIScaler(uICanvas);

        // Bring up the main menu
        new MainMenu();
    }
Ejemplo n.º 5
0
    // Unity fires off this function
    void Awake()
    {
        // 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>();
        updateList   = new List <IUpdateListener>();
        stats        = new StatsManager();
        stats.DownloadStats();

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

        string vSet = config.data.Get("UserConfig", "editorTransparency");

        if (vSet == "")
        {
            editorTransparency = 0.3f;
        }
        else
        {
            float.TryParse(vSet, out editorTransparency);
        }

        string s_debug_tests = config.data.Get("Debug", "tests");

        if (s_debug_tests != "")
        {
            s_debug_tests = s_debug_tests.ToLower();
            if (s_debug_tests == "true" || s_debug_tests == "1")
            {
                debugTests = true;
            }
        }

        // On android extract streaming assets for use
        if (Application.platform == RuntimePlatform.Android)
        {
            System.IO.Directory.CreateDirectory(ContentData.ContentPath());
            using (ZipFile jar = ZipFile.Read(Application.dataPath))
            {
                foreach (ZipEntry e in jar)
                {
                    if (!e.FileName.StartsWith("assets"))
                    {
                        continue;
                    }
                    if (e.FileName.StartsWith("assets/bin"))
                    {
                        continue;
                    }

                    e.Extract(ContentData.ContentPath() + "../..", ExtractExistingFileAction.OverwriteSilently);
                }
            }
        }

        DictionaryI18n valDict = new DictionaryI18n();

        foreach (string file in System.IO.Directory.GetFiles(ContentData.ContentPath() + "../text", "Localization*.txt"))
        {
            valDict.AddDataFromFile(file);
        }
        LocalizationRead.AddDictionary("val", valDict);

        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);

#if UNITY_STANDALONE_WIN
        SetScreenOrientationToLandscape();
#endif

        // Bring up the Game selector
        gameSelect = new GameSelectionScreen();
    }
Ejemplo n.º 6
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>();
        updateList   = new List <IUpdateListener>();

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

        // On android extract streaming assets for use
        if (Application.platform == RuntimePlatform.Android)
        {
            System.IO.Directory.CreateDirectory(ContentData.ContentPath());
            using (ZipFile jar = ZipFile.Read(Application.dataPath))
            {
                foreach (ZipEntry e in jar)
                {
                    if (e.FileName.IndexOf("assets") != 0)
                    {
                        continue;
                    }
                    if (e.FileName.IndexOf("assets/bin") == 0)
                    {
                        continue;
                    }

                    e.Extract(ContentData.ContentPath() + "../..", ExtractExistingFileAction.OverwriteSilently);
                }
            }
        }

        DictionaryI18n valDict = new DictionaryI18n();

        foreach (string file in System.IO.Directory.GetFiles(ContentData.ContentPath() + "../text", "Localization*.txt"))
        {
            valDict.AddDataFromFile(file);
        }
        LocalizationRead.AddDictionary("val", valDict);

        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
        gameSelect = new GameSelectionScreen();
    }