Esempio n. 1
0
        private void UpdateSession(bool notifySetupChange = true)
        {
            Session = new TriadGameSession();

            // create new instances of modifiers, required for things like roulette
            foreach (var rule in Rules)
            {
                TriadGameModifier modCopy = (TriadGameModifier)Activator.CreateInstance(rule.GetType());
                modCopy.OnMatchInit();

                Session.modifiers.Add(modCopy);
            }

            if (!isTournament)
            {
                foreach (var rule in Npc.Rules)
                {
                    TriadGameModifier modCopy = (TriadGameModifier)Activator.CreateInstance(rule.GetType());
                    modCopy.OnMatchInit();

                    Session.modifiers.Add(modCopy);
                }
            }

            Session.UpdateSpecialRules();
            GameReset();

            if (notifySetupChange)
            {
                OnSetupChanged?.Invoke(this);
            }
        }
Esempio n. 2
0
        private bool LoadAssets()
        {
            bool bResult = false;

            try
            {
                var resManager = new ResourceManager("FFTriadBuddy.Properties.Resources", Assembly.GetExecutingAssembly());
                var assets     = (byte[])resManager.GetObject("assets");

                if (AssetManager.Get().Init(assets))
                {
                    LocalizationDB.SetCurrentUserLanguage(CultureInfo.CurrentCulture.Name);

                    bResult = TriadCardDB.Get().Load();
                    bResult = bResult && TriadNpcDB.Get().Load();
                    bResult = bResult && ImageHashDB.Get().Load();
                    bResult = bResult && TriadTournamentDB.Get().Load();
                    bResult = bResult && LocalizationDB.Get().Load();

                    if (bResult)
                    {
                        SettingsModel.Initialize();
                        IconDB.Get().Load();
                        ModelProxyDB.Get().Load();

                        TriadGameSession.StaticInitialize();
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.WriteLine("Init failed: " + ex);
                bResult = false;
            }

            return(bResult);
        }