Beispiel #1
0
        public static void LoadRegistryValues(global::Session session)
        {
            KaijuCouncil.WildLiceArmyPreferences.ArmiesToSpawnCount = Amplitude.Unity.Runtime.Runtime.Registry.GetValue <int>("Gameplay/Kaiju/LiceArmy/ArmiesToSpawnCount", 1);
            KaijuCouncil.WildLiceArmyPreferences.SpawningCooldown   = Amplitude.Unity.Runtime.Runtime.Registry.GetValue <int>("Gameplay/Kaiju/LiceArmy/SpawningCooldown", 5);
            KaijuCouncil.WildLiceArmyPreferences.UnitsPerArmy       = Amplitude.Unity.Runtime.Runtime.Registry.GetValue <int>("Gameplay/Kaiju/LiceArmy/UnitsPerArmy", 4);
            KaijuCouncil.WildLiceArmyPreferences.ArmyTag            = new StaticString(Amplitude.Unity.Runtime.Runtime.Registry.GetValue <string>("Gameplay/Kaiju/LiceArmy/ArmyTag", "WildLiceArmy"));
            KaijuCouncil.WildLiceArmyPreferences.UnitTag            = new StaticString(Amplitude.Unity.Runtime.Runtime.Registry.GetValue <string>("Gameplay/Kaiju/LiceArmy/UnitTag", "WildLiceUnit"));
            string           text             = string.Empty;
            OptionDefinition optionDefinition = null;
            IDatabase <WorldGeneratorOptionDefinition> database = Databases.GetDatabase <WorldGeneratorOptionDefinition>(false);

            foreach (OptionDefinition optionDefinition2 in database)
            {
                if (optionDefinition2.Name.Equals("WorldSize"))
                {
                    optionDefinition = optionDefinition2;
                    break;
                }
            }
            if (optionDefinition != null)
            {
                text = session.GetLobbyData <string>(optionDefinition.Name, string.Empty);
            }
            if (!string.IsNullOrEmpty(text))
            {
                KaijuCouncil.WildLiceArmyPreferences.MaxArmiesAlive = Amplitude.Unity.Runtime.Runtime.Registry.GetValue <int>("Gameplay/Kaiju/LiceArmy/MaxArmiesAlive/World" + text, 3);
            }
            else
            {
                KaijuCouncil.WildLiceArmyPreferences.MaxArmiesAlive = Amplitude.Unity.Runtime.Runtime.Registry.GetValue <int>("Gameplay/Kaiju/LiceArmy/MaxArmiesAlive/Default" + text, 3);
            }
        }
Beispiel #2
0
    public void RefreshContent(global::Session session, bool readOnly)
    {
        if (this.OptionDefinition == null)
        {
            return;
        }
        if (!string.IsNullOrEmpty(this.OptionDefinition.EnableOn))
        {
            string a = session.GetLobbyData(this.OptionDefinition.EnableOn) as string;
            this.AgeTransform.Enable = (a == "True");
        }
        if (!string.IsNullOrEmpty(this.OptionDefinition.SubCategory) && this.OptionDefinition.SubCategory != this.OptionDefinition.Name)
        {
            string lobbyData = session.GetLobbyData <string>(this.OptionDefinition.SubCategory, null);
            if (lobbyData == "Random")
            {
                this.SetAvailable(false);
                return;
            }
        }
        this.SetAvailable(true);
        string lobbyData2 = session.GetLobbyData <string>(this.OptionDefinition.Name, null);

        if (this.OptionDefinition.GuiControlType == MenuSetting.GuiControlTypeToggle)
        {
            this.RefreshToggle(lobbyData2, readOnly);
        }
        else if (this.OptionDefinition.GuiControlType == MenuSetting.GuiControlTypeDropList)
        {
            this.RefreshDropList(lobbyData2, readOnly);
            if (this.OptionDefinition.ItemDefinitions != null)
            {
                for (int i = 0; i < this.OptionDefinition.ItemDefinitions.Length; i++)
                {
                    OptionDefinition.ItemDefinition itemDefinition = this.OptionDefinition.ItemDefinitions[i];
                    if (itemDefinition.OptionDefinitionConstraints != null)
                    {
                        bool flag = true;
                        foreach (OptionDefinitionConstraint optionDefinitionConstraint in from element in itemDefinition.OptionDefinitionConstraints
                                 where element.Type == OptionDefinitionConstraintType.Conditional
                                 select element)
                        {
                            if (string.IsNullOrEmpty(optionDefinitionConstraint.OptionName))
                            {
                                flag = false;
                                break;
                            }
                            string lobbyData3 = session.GetLobbyData <string>(optionDefinitionConstraint.OptionName, null);
                            if (string.IsNullOrEmpty(lobbyData3))
                            {
                                Diagnostics.LogWarning("Unhandled constraint on option '{0}' from option definition '{1}', item '{2}'.", new object[]
                                {
                                    optionDefinitionConstraint.OptionName,
                                    this.OptionDefinition.Name,
                                    itemDefinition.Name
                                });
                            }
                            else
                            {
                                if (optionDefinitionConstraint.Keys == null || optionDefinitionConstraint.Keys.Length == 0)
                                {
                                    flag = false;
                                    break;
                                }
                                if (!optionDefinitionConstraint.Keys.Select((OptionDefinitionConstraint.Key key) => key.Name).Contains(lobbyData3))
                                {
                                    flag = false;
                                    break;
                                }
                            }
                        }
                        if (flag)
                        {
                            IDownloadableContentService service = Services.GetService <IDownloadableContentService>();
                            if (service != null)
                            {
                                foreach (OptionDefinitionConstraint optionDefinitionConstraint2 in from element in itemDefinition.OptionDefinitionConstraints
                                         where element.Type == OptionDefinitionConstraintType.DownloadableContentConditional
                                         select element)
                                {
                                    if (string.IsNullOrEmpty(optionDefinitionConstraint2.OptionName))
                                    {
                                        flag = false;
                                        break;
                                    }
                                    if (!service.IsShared(optionDefinitionConstraint2.OptionName))
                                    {
                                        flag = false;
                                        break;
                                    }
                                }
                            }
                        }
                        this.DropList.EnableItem(i, flag);
                    }
                }
            }
        }
        else if (this.OptionDefinition.GuiControlType == MenuSetting.GuiControlTypeTextField)
        {
            this.RefreshTextField(lobbyData2, readOnly);
        }
    }