Example #1
0
        public IEnumerable <Tile> Clear()
        {
            var copy = new List <Tile>(Slots);

            Slots.Clear();
            return(copy);
        }
    public override void CalculatePosition(Vector2 targetPos)
    {
        Slots.Clear();
        float hordeRange = distanceBetweenTroops * troopsCount * groupSpreadingFactor;

        for (int i = 0; i < troopsCount; i++)
        {
            float   xOffset = Random.Range(0, hordeRange);
            float   yOffset = Random.Range(0, hordeRange);
            Vector2 newPos  = new Vector2(targetPos.x + xOffset, targetPos.y + yOffset);
            newPos = NavigationHelper.ValidatePosition(newPos, distanceBetweenTroops);
            Slots.Add(newPos);
        }
    }
Example #3
0
        /// <summary>
        ///     Reset the local data.
        /// </summary>
        public void Reset()
        {
            CVars.Clear();
            CVars.Add("tv_nochat", "0");
            CVars.Add("joy_autoaimdampen", "0");
            CVars.Add("name", _details.Name);
            CVars.Add("cl_interp_ratio", "2");
            CVars.Add("tv_listen_voice_indices", "0");
            CVars.Add("cl_predict", "0");
            CVars.Add("cl_updaterate", "30");
            CVars.Add("cl_showhelp", "1");
            CVars.Add("steamworks_sessionid_lifetime_client", "0");
            CVars.Add("cl_mouselook", "1");
            CVars.Add("steamworks_sessionid_client", "0");
            CVars.Add("dota_mute_cobroadcasters", "0");
            CVars.Add("voice_loopback", "0");
            CVars.Add("dota_player_initial_skill", "0");
            CVars.Add("cl_lagcompensation", "1");
            CVars.Add("closecaption", "0");
            CVars.Add("cl_language", "english");
            CVars.Add("english", "1");
            CVars.Add("cl_class", "default");
            CVars.Add("snd_voipvolume", "1");
            CVars.Add("snd_musicvolume", "1");
            CVars.Add("cl_cmdrate", "30");
            CVars.Add("net_maxroutable", "1200");
            CVars.Add("cl_team", "default");
            CVars.Add("rate", "80000");
            CVars.Add("cl_predictweapons", "1");
            CVars.Add("cl_interpolate", "1");
            CVars.Add("cl_interp", "0.05");
            CVars.Add("dota_camera_edgemove", "1");
            CVars.Add("snd_gamevolume", "1");
            CVars.Add("cl_spec_mode", "1");

            Classes.Clear();
            ClassesByName.Clear();
            SendTables.Clear();
            FlatTables.Clear();
            Properties.Clear();
            Slots.Clear();
            Strings.Clear();
            StringsIndex.Clear();

            Created.Clear();
            Deleted.Clear();
        }
Example #4
0
        public void CreateSlots()
        {
            Slots.ForEach(x => x.DestroyTile());
            Slots.Clear();

            for (int i = 0; i < _gameDatabaseData.Height; i++)
            {
                for (int j = 0; j < _gameDatabaseData.Width; j++)
                {
                    var position = new Vector3(j * (.75f + tileSpace.x), i * (1.0f + tileSpace.y));
                    position += j % 2 == 1 ? new Vector3(0f, -.5f) : Vector3.zero;

                    var slot = new Slot(position);
                    Slots.Add(slot);
                }
            }
        }
    public override void CalculatePosition(Vector2 targetPos)
    {
        Slots.Clear();
        int width           = Mathf.CeilToInt(troopsCount / numberOfColumns);
        int lastColumnWidth = width * numberOfColumns;

        lastColumnWidth = troopsCount - lastColumnWidth;
        for (int i = 0; i < troopsCount; i++)
        {
            int     currentWidth  = troopsCount - i > lastColumnWidth ? width : lastColumnWidth;
            float   xOffset       = ((i % currentWidth) - (currentWidth - 1) * 0.5f) * distanceBetweenTroops;
            int     currentColumn = Mathf.FloorToInt(i / width);
            float   yOffset       = (currentColumn - (numberOfColumns - 1) * 0.5f) * distanceBetweenTroops;
            Vector2 newPos        = new Vector2(targetPos.x + xOffset, targetPos.y + yOffset);
            newPos = NavigationHelper.ValidatePosition(newPos, distanceBetweenTroops);
            Slots.Add(newPos);
        }
    }
Example #6
0
        public void Copy(InventoryObject _inventory)
        {
            if (_inventory == null)
            {
                return;
            }

            base.Copy(_inventory);

            MaxSlots              = _inventory.MaxSlots;
            IgnoreInventoryOwner  = _inventory.IgnoreInventoryOwner;
            DefaultDropRange      = _inventory.DefaultDropRange;
            LastCollectedObjectID = _inventory.LastCollectedObjectID;
            UseDetachOnDie        = _inventory.UseDetachOnDie;

            Slots.Clear();
            foreach (InventorySlotObject _slot in _inventory.Slots)
            {
                Slots.Add(new InventorySlotObject(OwnerComponent, _slot));
            }
        }
Example #7
0
 public static void Clean()
 {
     Slots.Clear();
 }
Example #8
0
        public bool LoadConfig(string FileName, Dictionary <string, Collection <Sensor> > SensorsByNpt, bool force = false)
        {
            bool      ret    = true;
            XmlReader reader = XmlReader.Create(FileName);

            try
            {
                DataContractSerializer dcs = new DataContractSerializer(typeof(AppConfig));

                AppConfig config = (AppConfig)(new DataContractSerializer(typeof(AppConfig))).ReadObject(reader);

                foreach (var prop in this.GetType().GetProperties())
                {
                    if (prop.CanWrite)
                    {
                        object obj = prop.GetValue(config, null);
                        if (obj != null)
                        {
                            this.GetType().GetProperty(prop.Name).SetValue(this, obj, null);
                        }
                    }
                }
                reader.Close();
                Slots = config.Slots ?? new ObservableCollection <Slot>();
                if (Slots.Count == 0)
                {
                    for (int i = 1; i <= 10; i++)
                    {
                        Slots.Add(new Slot()
                        {
                            Name = i.ToString(), UseWarmUp = true, UseWriteFactorySettings = true
                        });
                    }
                }

                for (int ndx = 0; ndx < Slots.Count; ndx++)
                {
                    Slots[ndx].FactorySettings   = Slots[ndx].FactorySettings ?? new Dictionary <string, NptParam>();
                    Slots[ndx].CalibrateSettings = Slots[ndx].CalibrateSettings ?? new Dictionary <string, CalibrateParam>();
                    Slots[ndx].ProcessLogLines   = new ObservableCollection <ColoredText>();
                    Slots[ndx].WorkFlowState     = WFState.Nothing;

                    foreach (var key in SensorsByNpt.Keys)
                    {
                        if (!Slots[ndx].FactorySettings.ContainsKey(key))
                        {
                            Slots[ndx].FactorySettings.Add(key, null);
                        }
                        if (!Slots[ndx].CalibrateSettings.ContainsKey(key))
                        {
                            Slots[ndx].CalibrateSettings.Add(key, null);
                        }
                    }
                }

                DefaulSlot = DefaulSlot ?? new Slot()
                {
                    Name = "777"
                };
                DefaulSlot.FactorySettings   = DefaulSlot.FactorySettings ?? new Dictionary <string, NptParam>();
                DefaulSlot.CalibrateSettings = DefaulSlot.CalibrateSettings ?? new Dictionary <string, CalibrateParam>();

                foreach (var key in SensorsByNpt.Keys)
                {
                    if (!DefaulSlot.FactorySettings.ContainsKey(key))
                    {
                        DefaulSlot.FactorySettings.Add(key, null);
                    }
                    if (!DefaulSlot.CalibrateSettings.ContainsKey(key))
                    {
                        DefaulSlot.CalibrateSettings.Add(key, null);
                    }
                }
            }
            catch (Exception e)
            {
                if (force)
                {
                    ret = false;
                }
                else
                {
                    reader.Close();
                    Slots.Clear();
                    XmlWriter writer = XmlWriter.Create(FileName, new XmlWriterSettings {
                        Indent = true, IndentChars = "\t"
                    });
                    (new DataContractSerializer(typeof(AppConfig))).WriteObject(writer, this);
                    writer.Close();
                    LoadConfig(FileName, SensorsByNpt, true);
                }
            }

            return(ret);
        }
Example #9
0
 /// <summary>
 /// Removes cars attached to the locomotive and adds them to the line
 /// </summary>
 /// <param name="line">The line that cars will be unloaded into</param>
 public void UnloadAllCarsIntoLine(IIncrementableLine line)
 {
     Slots.ForEach(car => line.AddCar(car));
     Slots.Clear();
 }