Exemple #1
0
        static void LoadDbData()
        {
            var domainConfig = new NegotiationContainer().GameDomainConfigSet.FirstOrDefault();

            if (domainConfig != null)
            {
                Config     = domainConfig;
                GameDomain = domainConfig.GameDomain;

                LoadDomain();
            }
        }
Exemple #2
0
        internal static void SetDomainVariants(string humanSide, string humanVariant, string aiVariant)
        {
            NegotiationContainer cont = new NegotiationContainer();
            var domainConfig          = cont.GameDomainConfigSet.First();

            domainConfig.HumanSide    = humanSide;
            domainConfig.HumanVariant = humanVariant;
            domainConfig.AiSide       = Domain.OwnerVariantDict.Keys.Except(humanSide).First();
            domainConfig.AiVariant    = aiVariant;

            cont.SaveChanges();

            Config = domainConfig;
        }
Exemple #3
0
        internal static void SetNewDomain(int newActiveDomain)
        {
            NegotiationContainer cont = new NegotiationContainer();

            if (GameDomain != null)
            {
                var activeConfig = cont.GameDomainConfigSet.Find(GameDomain.Id);
                if (activeConfig != null)
                {
                    cont.GameDomainConfigSet.Remove(activeConfig);
                }
            }

            GameDomain = cont.GameDomainSet.Find(newActiveDomain);
            LoadDomain();

            string humanSide = Domain.OwnerVariantDict.Keys.First();
            string aiSide    = Domain.OwnerVariantDict.Keys.ElementAt(1);

            Config = new GameDomainConfig()
            {
                Id           = newActiveDomain,
                HumanSide    = humanSide,
                HumanVariant = Domain.OwnerVariantDict[humanSide].Keys.First(),
                AiSide       = aiSide,
                AiVariant    = Domain.OwnerVariantDict[aiSide].Keys.First()
            };

            cont.GameDomainConfigSet.Add(Config);

            try
            {
                cont.SaveChanges();
            }
            catch (Exception ex)
            {
                throw;
            }

            LoadDbData();
        }
        internal static void SetNewDomain(int newActiveDomain)
        {
            NegotiationContainer cont = new NegotiationContainer();

            if (GameDomain != null)
            {
                var activeConfig = cont.GameDomainConfigSet.Find(GameDomain.Id);
                if (activeConfig != null)
                {
                    cont.GameDomainConfigSet.Remove(activeConfig);
                }
            }

            GameDomain = cont.GameDomainSet.Find(newActiveDomain);
            LoadDomain();

            string humanSide = Domain.OwnerVariantDict.Keys.First();
            string aiSide = Domain.OwnerVariantDict.Keys.ElementAt(1);

            Config = new GameDomainConfig()
            {
                Id = newActiveDomain,
                HumanSide = humanSide,
                HumanVariant = Domain.OwnerVariantDict[humanSide].Keys.First(),
                AiSide = aiSide,
                AiVariant = Domain.OwnerVariantDict[aiSide].Keys.First()
            };

            cont.GameDomainConfigSet.Add(Config);

            try
            {
                cont.SaveChanges();
            }
            catch (Exception ex)
            {
                throw;
            }

            LoadDbData();
        }