void Updated(string apiname, dynamic data)
        {
            if (IsRemodeling)
            {
                if (apiname == "api_get_member/slot_item")
                {
                    IsRemodeling = false;
                }
                else
                {
                    return;
                }
            }
            if (apiname == "api_req_kaisou/remodeling")
            {
                IsRemodeling = true;
                return;
            }

            KCDatabase db = KCDatabase.Instance;

            if (db.Ships.Count == 0)
            {
                return;
            }

            FleetData fleet = db.Fleet.Fleets[FleetID];

            if (fleet == null)
            {
                return;
            }

            TableFleet.SuspendLayout();
            ControlFleet.Update(fleet);
            TableFleet.Visible = true;
            TableFleet.ResumeLayout();

            TableMember.SuspendLayout();
            for (int i = 0; i < ControlMember.Length; i++)
            {
                ControlMember[i].Update(fleet.Members[i]);
            }
            TableMember.ResumeLayout();


            if (Icon != null)
            {
                ResourceManager.DestroyIcon(Icon);
            }
            Icon = ResourceManager.ImageToIcon(ControlFleet.StateMain.Image);
            if (Parent != null)
            {
                Parent.Refresh();                                       //アイコンを更新するため
            }
        }
Beispiel #2
0
        void Updated(string apiname, dynamic data)
        {
            var keys = KCDatabase.Instance.BaseAirCorps.Keys;

            TableMember.SuspendLayout();
            for (int i = 0; i < ControlMember.Length; i++)
            {
                ControlMember[i].Update(i < keys.Count() ? keys.ElementAt(i) : -1);
            }
            TableMember.ResumeLayout();
        }
Beispiel #3
0
        void Updated(string apiname, dynamic data)
        {
            var db = KCDatabase.Instance;

            TableMember.SuspendLayout();
            for (int i = 0; i < ControlMember.Length; i++)
            {
                ControlMember[i].Update(i + 1);
            }
            TableMember.ResumeLayout();
        }
Beispiel #4
0
        public FormBaseAirCorps(FormMain parent)
        {
            InitializeComponent();


            ControlMember = new TableBaseAirCorpsControl[9];
            TableMember.SuspendLayout();
            for (int i = 0; i < ControlMember.Length; i++)
            {
                ControlMember[i] = new TableBaseAirCorpsControl(this, TableMember, i);
            }
            TableMember.ResumeLayout();

            ConfigurationChanged();

            Icon = ResourceManager.ImageToIcon(ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormBaseAirCorps]);
        }
Beispiel #5
0
        private void ConfigurationChanged()
        {
            var c = Utility.Configuration.Config;

            TableMember.SuspendLayout();

            Font = c.UI.MainFont;

            foreach (var control in ControlMember)
            {
                control.ConfigurationChanged(this);
            }

            ControlHelper.SetTableRowStyles(TableMember, ControlHelper.GetDefaultRowStyle());

            TableMember.ResumeLayout();
        }
        void UpdateTimerTick()
        {
            TableFleet.SuspendLayout();
            {
                FleetData fleet = KCDatabase.Instance.Fleet.Fleets[FleetID];
                if (fleet != null)
                {
                    ControlFleet.Refresh();
                }
            }
            TableFleet.ResumeLayout();

            TableMember.SuspendLayout();
            for (int i = 0; i < ControlMember.Length; i++)
            {
                ControlMember[i].HP.Refresh();
            }
            TableMember.ResumeLayout();
        }
Beispiel #7
0
        private void ConfigurationChanged()
        {
            var c = Utility.Configuration.Config;

            TableMember.SuspendLayout();

            Font = c.UI.MainFont;

            foreach (var control in ControlMember)
            {
                control.ConfigurationChanged(this);
            }

            ControlHelper.SetTableRowStyles(TableMember, ControlHelper.GetDefaultRowStyle());

            TableMember.ResumeLayout();

            if (KCDatabase.Instance.BaseAirCorps.Any())
            {
                Updated(null, null);
            }
        }
        public FormFleet(FormMain parent, int fleetID)
        {
            InitializeComponent();

            FleetID = fleetID;
            Utility.SystemEvents.UpdateTimerTick += UpdateTimerTick;

            ConfigurationChanged();

            MainFontColor = Color.FromArgb(0x00, 0x00, 0x00);
            SubFontColor  = Color.FromArgb(0x88, 0x88, 0x88);


            //ui init

            ControlHelper.SetDoubleBuffered(TableFleet);
            ControlHelper.SetDoubleBuffered(TableMember);


            TableFleet.Visible = false;
            TableFleet.SuspendLayout();
            TableFleet.BorderStyle = BorderStyle.FixedSingle;
            ControlFleet           = new TableFleetControl(this, TableFleet);
            TableFleet.ResumeLayout();


            TableMember.SuspendLayout();
            ControlMember = new TableMemberControl[6];
            for (int i = 0; i < ControlMember.Length; i++)
            {
                ControlMember[i] = new TableMemberControl(this, TableMember, i);
            }
            TableMember.ResumeLayout();


            ConfigurationChanged();                     //fixme: 苦渋の決断

            Icon = ResourceManager.ImageToIcon(ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormFleet]);
        }
Beispiel #9
0
        void Updated(string apiname, dynamic data)
        {
            var keys = KCDatabase.Instance.BaseAirCorps.Keys;

            if (Utility.Configuration.Config.FormBaseAirCorps.ShowEventMapOnly)
            {
                var eventAreaCorps = KCDatabase.Instance.BaseAirCorps.Values.Where(b =>
                {
                    var maparea = KCDatabase.Instance.MapArea[b.MapAreaID];
                    return(maparea != null && maparea.MapType == 1);
                }).Select(b => b.ID);

                if (eventAreaCorps.Any())
                {
                    keys = eventAreaCorps;
                }
            }


            TableMember.SuspendLayout();
            TableMember.RowCount = keys.Count();
            for (int i = 0; i < ControlMember.Length; i++)
            {
                ControlMember[i].Update(i < keys.Count() ? keys.ElementAt(i) : -1);
            }
            TableMember.ResumeLayout();

            // set icon
            {
                var squadrons = KCDatabase.Instance.BaseAirCorps.Values.Where(b => b != null)
                                .SelectMany(b => b.Squadrons.Values)
                                .Where(s => s != null);
                bool isNotReplenished = squadrons.Any(s => s.State == 1 && s.AircraftCurrent < s.AircraftMax);
                bool isTired          = squadrons.Any(s => s.State == 1 && s.Condition == 2);
                bool isVeryTired      = squadrons.Any(s => s.State == 1 && s.Condition == 3);

                int imageIndex;

                if (isNotReplenished)
                {
                    imageIndex = (int)ResourceManager.IconContent.FleetNotReplenished;
                }
                else if (isVeryTired)
                {
                    imageIndex = (int)ResourceManager.IconContent.ConditionVeryTired;
                }
                else if (isTired)
                {
                    imageIndex = (int)ResourceManager.IconContent.ConditionTired;
                }
                else
                {
                    imageIndex = (int)ResourceManager.IconContent.FormBaseAirCorps;
                }

                if (Icon != null)
                {
                    ResourceManager.DestroyIcon(Icon);
                }
                Icon = ResourceManager.ImageToIcon(ResourceManager.Instance.Icons.Images[imageIndex]);
                if (Parent != null)
                {
                    Parent.Refresh();                                       //アイコンを更新するため
                }
            }
        }