public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     m_subsystemTime        = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_subsystemSky         = base.Project.FindSubsystem <SubsystemSky>(throwOnError: true);
     m_subsystemBodies      = base.Project.FindSubsystem <SubsystemBodies>(throwOnError: true);
     m_componentCreature    = base.Entity.FindComponent <ComponentCreature>(throwOnError: true);
     m_componentPathfinding = base.Entity.FindComponent <ComponentPathfinding>(throwOnError: true);
     m_dayRange             = valuesDictionary.GetValue <float>("DayRange");
     m_nightRange           = valuesDictionary.GetValue <float>("NightRange");
     m_stateMachine.AddState("Inactive", delegate
     {
         m_importanceLevel = 0f;
         m_target          = null;
     }, delegate
     {
         if (IsActive)
         {
             m_stateMachine.TransitionTo("Move");
         }
         m_target = FindTarget(out float targetScore);
         if (m_target != null)
         {
             Vector3.Distance(m_target.ComponentBody.Position, m_componentCreature.ComponentBody.Position);
             SetImportanceLevel(targetScore);
         }
         else
         {
             m_importanceLevel = 0f;
         }
     }, null);
Пример #2
0
        public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
        {
            subsystemTimeOfDay     = Project.FindSubsystem <SubsystemTimeOfDay>();
            subsystemBlockEntities = Project.FindSubsystem <SubsystemBlockEntities>();
            subsystemViews         = Project.FindSubsystem <SubsystemViews>();
            quantity    = valuesDictionary.GetValue <int>("Quantity");
            maxquantity = valuesDictionary.GetValue <int>("MaxQuantity");
            mode        = valuesDictionary.GetValue <int>("Mode");
            int value = valuesDictionary.GetValue <int>("SlotsCount");

            for (int i = 0; i < value; i++)
            {
                m_slots.Add(new Slot());
            }
            ValuesDictionary value2 = valuesDictionary.GetValue <ValuesDictionary>("Slots");

            for (int j = 0; j < m_slots.Count; j++)
            {
                ValuesDictionary value3 = value2.GetValue <ValuesDictionary>("Slot" + j.ToString(CultureInfo.InvariantCulture), null);
                if (value3 != null)
                {
                    Slot slot = m_slots[j];
                    slot.Value = value3.GetValue <int>("Contents");
                    slot.Count = value3.GetValue <int>("Count");
                }
            }
        }
 public override void Load(ValuesDictionary valuesDictionary)
 {
     m_subsystemTerrain = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_subsystemAudio   = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     m_impactsSoundsValuesDictionary  = valuesDictionary.GetValue <ValuesDictionary>("ImpactSounds");
     m_footstepSoundsValuesDictionary = valuesDictionary.GetValue <ValuesDictionary>("FootstepSounds");
 }
Пример #4
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     base.Load(valuesDictionary, idToEntityMap);
     m_walkAnimationSpeed = valuesDictionary.GetValue <float>("WalkAnimationSpeed");
     m_walkLegsAngle      = valuesDictionary.GetValue <float>("WalkLegsAngle");
     m_walkBobHeight      = valuesDictionary.GetValue <float>("WalkBobHeight");
 }
Пример #5
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     ComponentBody           = base.Entity.FindComponent <ComponentBody>(throwOnError: true);
     ComponentHealth         = base.Entity.FindComponent <ComponentHealth>(throwOnError: true);
     ComponentSpawn          = base.Entity.FindComponent <ComponentSpawn>(throwOnError: true);
     ComponentCreatureSounds = base.Entity.FindComponent <ComponentCreatureSounds>(throwOnError: true);
     ComponentCreatureModel  = base.Entity.FindComponent <ComponentCreatureModel>(throwOnError: true);
     ComponentLocomotion     = base.Entity.FindComponent <ComponentLocomotion>(throwOnError: true);
     m_subsystemPlayerStats  = base.Project.FindSubsystem <SubsystemPlayerStats>(throwOnError: true);
     ConstantSpawn           = valuesDictionary.GetValue <bool>("ConstantSpawn");
     Category    = valuesDictionary.GetValue <CreatureCategory>("Category");
     DisplayName = valuesDictionary.GetValue <string>("DisplayName");
     if (DisplayName.StartsWith("[") && DisplayName.EndsWith("]"))
     {
         string[] lp = DisplayName.Substring(1, DisplayName.Length - 2).Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries);
         DisplayName = LanguageControl.GetDatabase("DisplayName", lp[1]);
     }
     m_killVerbs = HumanReadableConverter.ValuesListFromString <string>(',', valuesDictionary.GetValue <string>("KillVerbs"));
     if (m_killVerbs.Length == 0)
     {
         throw new InvalidOperationException("Must have at least one KillVerb");
     }
     if (!MathUtils.IsPowerOf2((long)Category))
     {
         throw new InvalidOperationException("A single category must be assigned for creature.");
     }
 }
Пример #6
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     m_subsystemTime                = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_subsystemGameInfo            = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
     m_componentCreature            = base.Entity.FindComponent <ComponentCreature>(throwOnError: true);
     m_componentMount               = base.Entity.FindComponent <ComponentMount>(throwOnError: true);
     m_componentSteedBehavior       = base.Entity.FindComponent <ComponentSteedBehavior>(throwOnError: true);
     m_componentEatPickableBehavior = base.Entity.FindComponent <ComponentEatPickableBehavior>(throwOnError: true);
     m_stubbornProbability          = valuesDictionary.GetValue <float>("StubbornProbability");
     m_stubbornEndTime              = valuesDictionary.GetValue <double>("StubbornEndTime");
     m_periodicEventOffset          = m_random.Float(0f, 100f);
     m_isSaddled = base.Entity.ValuesDictionary.DatabaseObject.Name.EndsWith("_Saddled");
     m_stateMachine.AddState("Inactive", null, delegate
     {
         if (m_subsystemTime.PeriodicGameTimeEvent(1.0, m_periodicEventOffset) && m_componentMount.Rider != null && m_random.Float(0f, 1f) < m_stubbornProbability && (!m_isSaddled || m_componentEatPickableBehavior.Satiation <= 0f))
         {
             m_stubbornEndTime = m_subsystemGameInfo.TotalElapsedGameTime + (double)m_random.Float(60f, 120f);
         }
         if (IsActive)
         {
             m_stateMachine.TransitionTo("Stubborn");
         }
     }, null);
     m_stateMachine.AddState("Stubborn", null, delegate
     {
         if (m_componentSteedBehavior.WasOrderIssued)
         {
             m_componentCreature.ComponentCreatureModel.HeadShakeOrder = m_random.Float(0.6f, 1f);
             m_componentCreature.ComponentCreatureSounds.PlayPainSound();
         }
     }, null);
     m_stateMachine.TransitionTo("Inactive");
 }
Пример #7
0
        public WorldPalette(ValuesDictionary valuesDictionary)
        {
            string[] array = valuesDictionary.GetValue("Colors", new string(';', 15)).Split(';');
            if (array.Length != 16)
            {
                throw new InvalidOperationException("Invalid colors.");
            }
            Colors = array.Select((string s, int i) => (!string.IsNullOrEmpty(s)) ? HumanReadableConverter.ConvertFromString <Color>(s) : DefaultColors[i]).ToArray();
            string[] array2 = valuesDictionary.GetValue("Names", new string(';', 15)).Split(';');
            if (array2.Length != 16)
            {
                throw new InvalidOperationException("Invalid color names.");
            }
            Names = array2.Select((string s, int i) => (!string.IsNullOrEmpty(s)) ? s : LanguageControl.Get(GetType().Name, i)).ToArray();
            string[] names = Names;
            int      num   = 0;

            while (true)
            {
                if (num < names.Length)
                {
                    if (!VerifyColorName(names[num]))
                    {
                        break;
                    }
                    num++;
                    continue;
                }
                return;
            }
            throw new InvalidOperationException("Invalid color name.");
        }
Пример #8
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     base.Load(valuesDictionary, idToEntityMap);
     m_fireTimeRemaining = valuesDictionary.GetValue("FireTimeRemaining", 0f);
     HeatLevel           = valuesDictionary.GetValue("HeatLevel", 0f);
     m_speed             = valuesDictionary.GetValue("Speed", 1f);
 }
Пример #9
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     m_subsystemPlayers   = base.Project.FindSubsystem <SubsystemPlayers>(throwOnError: true);
     m_subsystemTime      = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_subsystemUpdate    = base.Project.FindSubsystem <SubsystemUpdate>(throwOnError: true);
     m_subsystemGameInfo  = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
     m_subsystemTimeOfDay = base.Project.FindSubsystem <SubsystemTimeOfDay>(throwOnError: true);
     m_subsystemTerrain   = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_componentPlayer    = base.Entity.FindComponent <ComponentPlayer>(throwOnError: true);
     m_sleepStartTime     = valuesDictionary.GetValue <double>("SleepStartTime");
     m_allowManualWakeUp  = valuesDictionary.GetValue <bool>("AllowManualWakeUp");
     if (m_sleepStartTime == 0.0)
     {
         m_sleepStartTime = null;
     }
     if (m_sleepStartTime.HasValue)
     {
         m_sleepFactor = 1f;
         m_minWetness  = float.MaxValue;
     }
     m_componentPlayer.ComponentHealth.Attacked += delegate
     {
         if (IsSleeping && m_componentPlayer.ComponentVitalStats.Sleep > 0.25f)
         {
             WakeUp();
         }
     };
 }
Пример #10
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     m_subsystemGameInfo    = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
     m_componentCreature    = base.Entity.FindComponent <ComponentCreature>(throwOnError: true);
     m_milkRegenerationTime = valuesDictionary.GetValue <float>("MilkRegenerationTime");
     m_lastMilkingTime      = valuesDictionary.GetValue <double>("LastMilkingTime");
 }
Пример #11
0
        public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
        {
            m_subsystemGameInfo       = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
            m_subsystemSky            = base.Project.FindSubsystem <SubsystemSky>(throwOnError: true);
            m_subsystemParticles      = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
            m_subsystemAudio          = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
            m_componentSpawn          = base.Entity.FindComponent <ComponentSpawn>(throwOnError: true);
            m_componentBody           = base.Entity.FindComponent <ComponentBody>(throwOnError: true);
            m_componentHealth         = base.Entity.FindComponent <ComponentHealth>(throwOnError: true);
            m_dayEntityTemplateName   = valuesDictionary.GetValue <string>("DayEntityTemplateName");
            m_nightEntityTemplateName = valuesDictionary.GetValue <string>("NightEntityTemplateName");
            float value = valuesDictionary.GetValue <float>("Probability");

            if (!string.IsNullOrEmpty(m_dayEntityTemplateName))
            {
                DatabaseManager.FindEntityValuesDictionary(m_dayEntityTemplateName, throwIfNotFound: true);
            }
            if (!string.IsNullOrEmpty(m_nightEntityTemplateName))
            {
                DatabaseManager.FindEntityValuesDictionary(m_nightEntityTemplateName, throwIfNotFound: true);
            }
            m_timeToSwitch              = s_random.Float(3f, 15f);
            IsEnabled                   = (s_random.Float(0f, 1f) < value);
            m_componentSpawn.Despawned += ComponentSpawn_Despawned;
        }
Пример #12
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     base.Load(valuesDictionary, idToEntityMap);
     m_furnaceSize       = SlotsCount - 2;
     m_fireTimeRemaining = valuesDictionary.GetValue("FireTimeRemaining", 0f);
     HeatLevel           = valuesDictionary.GetValue("HeatLevel", 0f);
 }
        public bool PlayFootstepSound(ComponentCreature componentCreature, float loudnessMultiplier)
        {
            string footstepSoundMaterialName = GetFootstepSoundMaterialName(componentCreature);

            if (!string.IsNullOrEmpty(footstepSoundMaterialName))
            {
                string value = componentCreature.ComponentCreatureSounds.ValuesDictionary.GetValue <ValuesDictionary>("CustomFootstepSounds").GetValue <string>(footstepSoundMaterialName, null);
                if (string.IsNullOrEmpty(value))
                {
                    value = m_footstepSoundsValuesDictionary.GetValue <string>(footstepSoundMaterialName, null);
                }
                if (!string.IsNullOrEmpty(value))
                {
                    float pitch = m_random.Float(-0.2f, 0.2f);
                    m_subsystemAudio.PlayRandomSound(value, 0.75f * loudnessMultiplier, pitch, componentCreature.ComponentBody.Position, 2f * loudnessMultiplier, autoDelay: true);
                    ComponentPlayer componentPlayer = componentCreature as ComponentPlayer;
                    if (componentPlayer != null && componentPlayer.ComponentVitalStats.Wetness > 0f)
                    {
                        string value2 = m_footstepSoundsValuesDictionary.GetValue <string>("Squishy", null);
                        if (!string.IsNullOrEmpty(value2))
                        {
                            float volume = 0.7f * loudnessMultiplier * MathUtils.Pow(componentPlayer.ComponentVitalStats.Wetness, 4f);
                            m_subsystemAudio.PlayRandomSound(value2, volume, pitch, componentCreature.ComponentBody.Position, 2f * loudnessMultiplier, autoDelay: true);
                        }
                    }
                    return(true);
                }
            }
            return(false);
        }
Пример #14
0
        public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
        {
            m_activeSlotIndex = valuesDictionary.GetValue <int>("ActiveSlotIndex");
            OpenSlotsCount    = valuesDictionary.GetValue <int>("OpenSlotsCount");
            CategoryIndex     = valuesDictionary.GetValue <int>("CategoryIndex");
            PageIndex         = valuesDictionary.GetValue <int>("PageIndex");
            for (int i = 0; i < OpenSlotsCount; i++)
            {
                m_slots.Add(0);
            }
            foreach (Block item in BlocksManager.Blocks.OrderBy((Block b) => b.DisplayOrder))
            {
                foreach (int creativeValue in item.GetCreativeValues())
                {
                    m_slots.Add(creativeValue);
                }
            }
            ValuesDictionary value = valuesDictionary.GetValue <ValuesDictionary>("Slots", null);

            if (value == null)
            {
                return;
            }
            for (int j = 0; j < OpenSlotsCount; j++)
            {
                ValuesDictionary value2 = value.GetValue <ValuesDictionary>("Slot" + j.ToString(CultureInfo.InvariantCulture), null);
                if (value2 != null)
                {
                    m_slots[j] = value2.GetValue <int>("Contents");
                }
            }
        }
Пример #15
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     m_subsystemGlow          = base.Project.FindSubsystem <SubsystemGlow>(throwOnError: true);
     m_subsystemTerrain       = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_componentCreatureModel = base.Entity.FindComponent <ComponentCreatureModel>(throwOnError: true);
     GlowingEyesOffset        = valuesDictionary.GetValue <Vector3>("GlowingEyesOffset");
     GlowingEyesColor         = valuesDictionary.GetValue <Color>("GlowingEyesColor");
 }
Пример #16
0
 public override void Load(ValuesDictionary valuesDictionary)
 {
     m_subsystemTime = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     WorldSettings   = new WorldSettings();
     WorldSettings.Load(valuesDictionary);
     DirectoryName        = valuesDictionary.GetValue <string>("WorldDirectoryName");
     TotalElapsedGameTime = valuesDictionary.GetValue <double>("TotalElapsedGameTime");
     WorldSeed            = valuesDictionary.GetValue <int>("WorldSeed");
 }
Пример #17
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     m_subsystemGameInfo  = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
     m_subsystemPickables = base.Project.FindSubsystem <SubsystemPickables>(throwOnError: true);
     m_componentCreature  = base.Entity.FindComponent <ComponentCreature>(throwOnError: true);
     m_lootDropped        = valuesDictionary.GetValue <bool>("LootDropped");
     m_lootList           = ParseLootList(valuesDictionary.GetValue <ValuesDictionary>("Loot"));
     m_lootOnFireList     = ParseLootList(valuesDictionary.GetValue <ValuesDictionary>("LootOnFire"));
 }
 public override void Load(ValuesDictionary valuesDictionary)
 {
     base.Load(valuesDictionary);
     m_subsystemGameInfo     = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
     m_subsystemItemsScanner = base.Project.FindSubsystem <SubsystemItemsScanner>(throwOnError: true);
     m_lastRotTime           = valuesDictionary.GetValue <double>("LastRotTime");
     m_rotStep = valuesDictionary.GetValue <int>("RotStep");
     m_subsystemItemsScanner.ItemsScanned += ItemsScanned;
     m_isRotEnabled = (m_subsystemGameInfo.WorldSettings.GameMode != 0 && m_subsystemGameInfo.WorldSettings.GameMode != GameMode.Adventure);
 }
Пример #19
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     m_subsystemGameInfo  = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
     m_subsystemTerrain   = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_subsystemTime      = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_subsystemAudio     = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     m_subsystemParticles = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
     m_componentPlayer    = base.Entity.FindComponent <ComponentPlayer>(throwOnError: true);
     m_fluDuration        = valuesDictionary.GetValue <float>("FluDuration");
     m_fluOnset           = valuesDictionary.GetValue <float>("FluOnset");
 }
Пример #20
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     base.Load(valuesDictionary, idToEntityMap);
     if (m_componentBlockEntity != null)
     {
         Coordinates = m_componentBlockEntity.Coordinates;
     }
     m_furnaceSize       = SlotsCount - 2;
     m_fireTimeRemaining = valuesDictionary.GetValue("FireTimeRemaining", 0f);
     HeatLevel           = valuesDictionary.GetValue("HeatLevel", 0f);
 }
Пример #21
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     base.Load(valuesDictionary, idToEntityMap);
     m_furnaceSize       = SlotsCount - 1;
     m_fireTimeRemaining = valuesDictionary.GetValue("FireTimeRemaining", 0f);
     HeatLevel           = valuesDictionary.GetValue("HeatLevel", 0f);
     //m_speed = valuesDictionary.GetValue("Speed", 0.1f);
     //m_count = valuesDictionary.GetValue("Count", 1);
     m_speed = 0.1f;
     m_count = 1;
 }
Пример #22
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     base.Load(valuesDictionary, idToEntityMap);
     ExplosionPressure = valuesDictionary.GetValue("ExplosionPressure", 60f);
     MineType          = valuesDictionary.GetValue <MineType>("Type", 0);
     Delay             = valuesDictionary.GetValue("Delay", .0);
     (ComponentBody = Entity.FindComponent <ComponentBody>(true)).CollidedWithBody += CollidedWithBody;
     if ((MineType & MineType.Torpedo) != 0)
     {
         ComponentBody.Density = .8f;
     }
 }
Пример #23
0
        public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
        {
            m_subsystemGameInfo       = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
            m_subsystemAudio          = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
            m_subsystemTimeOfDay      = base.Project.FindSubsystem <SubsystemTimeOfDay>(throwOnError: true);
            m_subsystemTerrain        = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
            m_subsystemBlockBehaviors = base.Project.FindSubsystem <SubsystemBlockBehaviors>(throwOnError: true);
            m_componentPlayer         = base.Entity.FindComponent <ComponentPlayer>(throwOnError: true);
            ContainerWidget guiWidget = m_componentPlayer.GuiWidget;

            m_backButtonWidget        = guiWidget.Children.Find <ButtonWidget>("BackButton");
            m_inventoryButtonWidget   = guiWidget.Children.Find <ButtonWidget>("InventoryButton");
            m_clothingButtonWidget    = guiWidget.Children.Find <ButtonWidget>("ClothingButton");
            m_moreButtonWidget        = guiWidget.Children.Find <ButtonWidget>("MoreButton");
            m_moreContentsWidget      = guiWidget.Children.Find <Widget>("MoreContents");
            m_helpButtonWidget        = guiWidget.Children.Find <ButtonWidget>("HelpButton");
            m_photoButtonWidget       = guiWidget.Children.Find <ButtonWidget>("PhotoButton");
            m_lightningButtonWidget   = guiWidget.Children.Find <ButtonWidget>("LightningButton");
            m_timeOfDayButtonWidget   = guiWidget.Children.Find <ButtonWidget>("TimeOfDayButton");
            m_cameraButtonWidget      = guiWidget.Children.Find <ButtonWidget>("CameraButton");
            m_creativeFlyButtonWidget = guiWidget.Children.Find <ButtonWidget>("CreativeFlyButton");
            m_sneakButtonWidget       = guiWidget.Children.Find <ButtonWidget>("SneakButton");
            m_mountButtonWidget       = guiWidget.Children.Find <ButtonWidget>("MountButton");
            m_editItemButton          = guiWidget.Children.Find <ButtonWidget>("EditItemButton");
            MoveWidget                     = guiWidget.Children.Find <TouchInputWidget>("Move");
            MoveRoseWidget                 = guiWidget.Children.Find <MoveRoseWidget>("MoveRose");
            LookWidget                     = guiWidget.Children.Find <TouchInputWidget>("Look");
            ViewWidget                     = m_componentPlayer.ViewWidget;
            HealthBarWidget                = guiWidget.Children.Find <ValueBarWidget>("HealthBar");
            FoodBarWidget                  = guiWidget.Children.Find <ValueBarWidget>("FoodBar");
            TemperatureBarWidget           = guiWidget.Children.Find <ValueBarWidget>("TemperatureBar");
            LevelLabelWidget               = guiWidget.Children.Find <LabelWidget>("LevelLabel");
            m_modalPanelContainerWidget    = guiWidget.Children.Find <ContainerWidget>("ModalPanelContainer");
            ControlsContainerWidget        = guiWidget.Children.Find <ContainerWidget>("ControlsContainer");
            m_leftControlsContainerWidget  = guiWidget.Children.Find <ContainerWidget>("LeftControlsContainer");
            m_rightControlsContainerWidget = guiWidget.Children.Find <ContainerWidget>("RightControlsContainer");
            m_moveContainerWidget          = guiWidget.Children.Find <ContainerWidget>("MoveContainer");
            m_lookContainerWidget          = guiWidget.Children.Find <ContainerWidget>("LookContainer");
            m_moveRectangleWidget          = guiWidget.Children.Find <RectangleWidget>("MoveRectangle");
            m_lookRectangleWidget          = guiWidget.Children.Find <RectangleWidget>("LookRectangle");
            m_moveRectangleContainerWidget = guiWidget.Children.Find <ContainerWidget>("MoveRectangleContainer");
            m_lookRectangleContainerWidget = guiWidget.Children.Find <ContainerWidget>("LookRectangleContainer");
            m_moveRectangleWidget          = guiWidget.Children.Find <RectangleWidget>("MoveRectangle");
            m_lookRectangleWidget          = guiWidget.Children.Find <RectangleWidget>("LookRectangle");
            m_movePadContainerWidget       = guiWidget.Children.Find <ContainerWidget>("MovePadContainer");
            m_lookPadContainerWidget       = guiWidget.Children.Find <ContainerWidget>("LookPadContainer");
            m_moveButtonsContainerWidget   = guiWidget.Children.Find <ContainerWidget>("MoveButtonsContainer");
            ShortInventoryWidget           = guiWidget.Children.Find <ShortInventoryWidget>("ShortInventory");
            m_largeMessageWidget           = guiWidget.Children.Find <ContainerWidget>("LargeMessage");
            m_messageWidget                = guiWidget.Children.Find <MessageWidget>("Message");
            m_keyboardHelpMessageShown     = valuesDictionary.GetValue <bool>("KeyboardHelpMessageShown");
            m_gamepadHelpMessageShown      = valuesDictionary.GetValue <bool>("GamepadHelpMessageShown");
        }
Пример #24
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     //base.Load(valuesDictionary, idToEntityMap);
     m_matchedIngredients = new string[36];
     this.LoadItems(valuesDictionary);
     //m_subsystemExplosions = Project.FindSubsystem<SubsystemExplosions>(true);
     m_componentBlockEntity = Entity.FindComponent <ComponentBlockEntity>(true);
     m_fireTimeRemaining    = valuesDictionary.GetValue("FireTimeRemaining", 0f);
     m_furnaceSize          = SlotsCount - 5;
     m_fireTimeRemaining    = valuesDictionary.GetValue("FireTimeRemaining", 0f);
     m_updateSmeltingRecipe = true;
 }
Пример #25
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     m_subsystemTerrain  = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_subsystemTime     = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_componentCreature = base.Entity.FindComponent <ComponentCreature>(throwOnError: true);
     m_alwaysEnabled     = valuesDictionary.GetValue <bool>("AlwaysEnabled");
     m_jumpStrength      = valuesDictionary.GetValue <float>("JumpStrength");
     m_componentCreature.ComponentBody.CollidedWithBody += delegate
     {
         m_collidedWithBody = true;
     };
 }
Пример #26
0
 public override void Load(ValuesDictionary valuesDictionary)
 {
     m_subsystemTime     = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_nextPlayerIndex   = valuesDictionary.GetValue <int>("NextPlayerIndex");
     GlobalSpawnPosition = valuesDictionary.GetValue <Vector3>("GlobalSpawnPosition");
     foreach (KeyValuePair <string, object> item in valuesDictionary.GetValue <ValuesDictionary>("Players"))
     {
         PlayerData playerData = new PlayerData(base.Project);
         playerData.Load((ValuesDictionary)item.Value);
         playerData.PlayerIndex = int.Parse(item.Key, CultureInfo.InvariantCulture);
         m_playersData.Add(playerData);
     }
 }
        public static void save_colors()
        {
            if (p_c__ == null)
            {
                return;
            }



            WorldInfo i = WorldsManager.GetWorldInfo(API_WE_Mod.API_WE.n_w);


            var path = Storage.CombinePaths(n_w, "Project.xml");

            if (!Storage.FileExists(path))
            {
                return;
            }
            var xelement = (XElement)null;

            using (var stream = Storage.OpenFile(path, OpenFileMode.Read))
            {
                xelement = XmlUtils.LoadXmlFromStream(stream, null, true);
            }

            var gameInfoNode     = GetGameInfoNode(xelement);
            var valuesDictionary = new ValuesDictionary();

            valuesDictionary.ApplyOverrides(gameInfoNode);


            i.WorldSettings.Save(valuesDictionary, true);
            Log.Warning("cur palette " + valuesDictionary.GetValue <ValuesDictionary>("Palette").GetValue <string>("Colors"));



            valuesDictionary.SetValue("Palette", Save());


            gameInfoNode.RemoveNodes();
            valuesDictionary.Save(gameInfoNode);

            Log.Warning("cur palette 2 " + valuesDictionary.GetValue <ValuesDictionary>("Palette").GetValue <string>("Colors"));
            using (var stream = Storage.OpenFile(path, OpenFileMode.Create))
            {
                XmlUtils.SaveXmlToStream(xelement, stream, null, true);
            }
            Log.Warning("Color saves");
            p_c__ = null;
        }
Пример #28
0
        public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
        {
            m_subsystemSky   = base.Project.FindSubsystem <SubsystemSky>(throwOnError: true);
            m_componentFrame = base.Entity.FindComponent <ComponentFrame>(throwOnError: true);
            string value = valuesDictionary.GetValue <string>("ModelName");

            Model       = ContentManager.Get <Model>(value);
            CastsShadow = valuesDictionary.GetValue <bool>("CastsShadow");
            string value2 = valuesDictionary.GetValue <string>("TextureOverride");

            TextureOverride        = (string.IsNullOrEmpty(value2) ? null : ContentManager.Get <Texture2D>(value2));
            PrepareOrder           = valuesDictionary.GetValue <int>("PrepareOrder");
            m_boundingSphereRadius = valuesDictionary.GetValue <float>("BoundingSphereRadius");
        }
Пример #29
0
        public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
        {
            m_subsystemGameInfo = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
            ComponentFrame      = base.Entity.FindComponent <ComponentFrame>(throwOnError: true);
            ComponentCreature   = base.Entity.FindComponent <ComponentCreature>();
            AutoDespawn         = valuesDictionary.GetValue <bool>("AutoDespawn");
            double value  = valuesDictionary.GetValue <double>("SpawnTime");
            double value2 = valuesDictionary.GetValue <double>("DespawnTime");

            SpawnDuration   = 2f;
            DespawnDuration = 2f;
            SpawnTime       = ((value < 0.0) ? m_subsystemGameInfo.TotalElapsedGameTime : value);
            DespawnTime     = ((value2 >= 0.0) ? new double?(value2) : null);
        }
Пример #30
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     base.Load(valuesDictionary, idToEntityMap);
     m_subsystemTerrain        = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_subsystemModelsRenderer = base.Project.FindSubsystem <SubsystemModelsRenderer>(throwOnError: true);
     m_subsystemNoise          = base.Project.FindSubsystem <SubsystemNoise>(throwOnError: true);
     m_subsystemAudio          = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     m_componentMiner          = base.Entity.FindComponent <ComponentMiner>();
     m_componentRider          = base.Entity.FindComponent <ComponentRider>();
     m_componentSleep          = base.Entity.FindComponent <ComponentSleep>();
     m_componentPlayer         = base.Entity.FindComponent <ComponentPlayer>();
     m_walkAnimationSpeed      = valuesDictionary.GetValue <float>("WalkAnimationSpeed");
     m_walkBobHeight           = valuesDictionary.GetValue <float>("WalkBobHeight");
     m_walkLegsAngle           = valuesDictionary.GetValue <float>("WalkLegsAngle");
 }