Example #1
0
        public ShipCardInfo(string shipName, BaseSize baseSize, Faction faction, ShipArcsInfo arcInfo, int agility, int hull, int shields, ShipActionsInfo actionIcons, ShipUpgradesInfo upgradeIcons, char icon = ' ', Faction subFaction = Faction.None, List <Faction> factionsAll = null)
        {
            ShipName = shipName;
            BaseSize = baseSize;

            DefaultShipFaction = faction;
            if (subFaction != Faction.None)
            {
                SubFaction = subFaction;
            }

            ArcInfo = arcInfo;

            Agility = agility;
            Hull    = hull;
            Shields = shields;

            ActionIcons  = actionIcons;
            UpgradeIcons = upgradeIcons;

            Icon = icon;

            FactionsAll = (factionsAll != null) ? factionsAll : new List <Faction>()
            {
                faction
            };
        }
Example #2
0
        public BaseManager(Byte[] mapData, ShortChat msg, MyGame psyGame)
        {
            // Load all vars
            m_Lobby             = new Base();
            m_Bases             = new List <Base>();
            this.msg            = msg;
            this.psyGame        = psyGame;
            ran                 = new Random();
            m_Mode              = BaseMode.Shuffle;
            m_SizeMode          = BaseSize.Off;
            m_ShuffleModeQ      = new Queue <int>();
            m_ShuffleModeQCount = 10;
            m_RoundRobinCount   = 0;
            m_BasesInUse        = new List <int>();

            // Byte array tunrned into arrays i can work with
            MapData my_MapInfo = new MapData(mapData);

            // Map scanner. Loads/Configures/Saves Bases
            BaseLoader my_BaseLoader = new BaseLoader(my_MapInfo.TileIDs, my_MapInfo.TileTypes);

            my_BaseLoader.LoadBasesFromMap(m_Bases, m_Lobby);

            // Load next base from default random
            ReShuffleQ(true);
            //getNextBase();
        }
Example #3
0
        /// <summary>
        /// <para>Load the next available Base.</para>
        /// <para>BaseMode is what determins what base to load next.</para>
        /// </summary>
        /// <returns>Next base in queue</returns>
        public Base getNextBase(string Requester, BaseSize size)
        {
            bool reload  = true;
            int  newBase = 0;

            while (reload)
            {
                if (size == BaseSize.Off)
                {
                    reload = false;
                }

                switch (m_Mode)
                {
                case BaseMode.Shuffle:
                    newBase = m_ShuffleModeQ.Dequeue();
                    // keep our q at a minimum of [m_ModeZeroMinCount] - add to shuffle if we fall below
                    if (m_ShuffleModeQ.Count < m_ShuffleModeQCount)
                    {
                        ReShuffleQ(false);
                    }
                    break;

                case BaseMode.RoundRobin:
                    m_RoundRobinCount = (m_RoundRobinCount + 1) >= m_Bases.Count ? 0 : m_RoundRobinCount + 1;
                    newBase           = m_RoundRobinCount;
                    break;

                case BaseMode.Random:
                    newBase = ran.Next(0, m_Bases.Count);
                    break;
                }

                // make sure base isnt in use
                if (!m_BasesInUse.Contains(newBase))
                {
                    reload = false;
                }

                // If the base is set to a certain size
                if (m_SizeMode != BaseSize.Off && size == m_Bases[newBase].Size)
                {
                    reload = false;
                }

                // Rep range is 400 pixels - run a prox check to make sure we arent releasing a base within rep prox distance
                if (!this.baseSafeFromProx(newBase))
                {
                    reload = true;
                }

                // add base to "in-use" list
                if (reload == false)
                {
                    m_BasesInUse.Add(newBase);
                }
            }
            psyGame.Send(msg.debugChan("[ BaseManager ] - [ " + Requester + " ] has checked out Base[ " + newBase + " ]. Total bases checked out:[ " + this.m_BasesInUse.Count + " ]"));
            return(m_Bases[newBase]);
        }
 public ImageMapMessage(Uri baseUrl, string altText, BaseSize baseSize)
 {
     this.BaseUrl  = baseUrl;
     this.AltText  = altText;
     this.BaseSize = baseSize;
     this._actions = new List <ImageMapAction>();
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="BaseURL"></param>
 /// <param name="AltText"></param>
 /// <param name="actionsBase"></param>
 /// <param name="BaseSize"></param>
 public ImageMapMessage(string BaseURL, string AltText, BaseSize BaseSize = null, IList <ImageMapActionsBase> actionsBase = null) : this()
 {
     baseUrl = BaseURL;
     altText = AltText;
     if (BaseSize != null)
     {
         baseSize = BaseSize;
     }
     if (actionsBase != null)
     {
         actions = actionsBase.ToList();
     }
 }
Example #6
0
 private void cboBaseB_SelectionChangeCommitted(object sender, EventArgs e)
 {
     _width         = cboBaseB.SelectedItem as BaseSize; //ширина
     txtResult.Text = BuildBlockName(txtResult.Text, 8, _width.Value.Substring(0, 2));
 }
Example #7
0
 //выбор базовых размеров
 private void cboBaseH_SelectionChangeCommitted(object sender, EventArgs e)
 {
     _height        = cboBaseH.SelectedItem as BaseSize; //высота
     txtResult.Text = BuildBlockName(txtResult.Text, 5, _height.Value.Substring(0, 2));
 }
        public void Load()
        {
            Reset();

            if (File.Exists(SettingsPath))
            {
                Log.Debug("SettingsPath", SettingsPath);

                try
                {
                    using (var reader = new StreamReader(SettingsPath))
                    {
                        string line = null;
                        while ((line = reader.ReadLine()) != null)
                        {
                            var value = ReadValue(line, "FontFamily");
                            if (value != null)
                            {
                                FontFamily = value;
                                var index = Array.IndexOf(FontFamilies, FontFamily);
                                if (index == -1)
                                {
                                    FontFamily = DefaultFontFamily;
                                }
                            }

                            value = ReadValue(line, "BaseSize");
                            if (value != null)
                            {
                                int result = 0;
                                if (int.TryParse(value, out result))
                                {
                                    BaseSize = result;
                                    var index = Array.IndexOf(BaseSizes, BaseSize.ToString());
                                    if (index == -1)
                                    {
                                        BaseSize = DefaultBaseSize;
                                    }
                                }
                                else
                                {
                                    BaseSize = DefaultBaseSize;
                                }
                            }

                            value = ReadValue(line, "IncreaseSmallText");
                            if (value != null)
                            {
                                bool result = false;
                                if (bool.TryParse(value, out result))
                                {
                                    IncreaseSmallText = result;
                                }
                                else
                                {
                                    IncreaseSmallText = DefaultIncreaseSmallText;
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Log.Error("Settings", ex.Message);
                    Reset();
                }
            }

            Game.UpdateUI(this);
            Log.Debug("Settings", "Loaded");
        }
 /// <summary>
 /// 初始化
 /// </summary>
 public ImageMapMessage() : base(SendMessageType.imagemap)
 {
     actions  = new List <ImageMapActionsBase>();
     baseSize = new BaseSize();
 }
Example #10
0
 public int CompareTo(BoxBase other)
 {
     return(BaseSize.CompareTo(other.BaseSize));
 }