Ejemplo n.º 1
0
        public bool IsValidChangeTankerCount(int area_id, int count)
        {
            AreaTankerModel tankerCount = ManagerBase._area[area_id].GetTankerCount();
            int             count2      = tankerCount.GetCount();

            if (count2 > count)
            {
                int num    = count2 - count;
                int count3 = new Api_req_Transport().GetEnableBackTanker(area_id).Count;
                if (count3 < num)
                {
                    return(false);
                }
                return(true);
            }
            if (count2 < count)
            {
                int num2 = count - count2;
                if (!ManagerBase._area[area_id].IsOpen())
                {
                    return(false);
                }
                if (tankerCount.GetMaxCount() < count)
                {
                    return(false);
                }
                AreaTankerModel nonDeploymentTankerCount = GetNonDeploymentTankerCount();
                if (nonDeploymentTankerCount.GetCount() - nonDeploymentTankerCount.GetCountMove() < num2)
                {
                    return(false);
                }
                return(true);
            }
            return(true);
        }
Ejemplo n.º 2
0
        public string ToString(bool detail)
        {
            string empty = string.Empty;

            empty += $"{base.ToString()}\n";
            AreaTankerModel nonDeploymentTankerCount = GetNonDeploymentTankerCount();

            empty += $"海域に未配備の輸送船数:{nonDeploymentTankerCount.GetCount()}(帰港中:{nonDeploymentTankerCount.GetCountMove()})\n";
            if (detail)
            {
                empty += $"[--海域一覧--]\n";
                Dictionary <int, MapAreaModel> area = Area;
                foreach (MapAreaModel value in area.Values)
                {
                    SortieManager sortieManager = SelectArea(value.Id);
                    MapModel[]    maps          = sortieManager.Maps;
                    empty += $"{value} ";
                    foreach (MapModel mapModel in maps)
                    {
                        empty = ((!mapModel.Map_Possible) ? (empty + string.Format("({0}-{1}{2}{3}) ", mapModel.AreaId, mapModel.No, (!mapModel.Cleared) ? string.Empty : "[Clear]", (!mapModel.ClearedOnce) ? string.Empty : "!")) : (empty + string.Format("{0}-{1}{2}{3} ", mapModel.AreaId, mapModel.No, (!mapModel.Cleared) ? string.Empty : "[Clear]", (!mapModel.ClearedOnce) ? string.Empty : "!")));
                    }
                    empty += "\n";
                }
                empty += $"[--海域一覧--]";
            }
            return(empty);
        }
Ejemplo n.º 3
0
        public void GetTankerCountRange(int area_id, out int out_max, out int out_min)
        {
            AreaTankerModel tankerCount = ManagerBase._area[area_id].GetTankerCount();
            AreaTankerModel nonDeploymentTankerCount = GetNonDeploymentTankerCount();

            out_max = tankerCount.GetCount() + nonDeploymentTankerCount.GetCount() - nonDeploymentTankerCount.GetCountMove();
            out_max = Math.Min(out_max, tankerCount.GetMaxCount());
            out_min = tankerCount.GetCountMove();
        }
        public bool IsValidDeploy(int area_id, int tanker_count, EscortDeckManager escort)
        {
            if (!this.IsValidChangeTankerCount(area_id, tanker_count))
            {
                return(false);
            }
            AreaTankerModel tankerCount = ManagerBase._area.get_Item(area_id).GetTankerCount();

            return(escort.HasChanged() || tankerCount.GetCount() != tanker_count);
        }
        public string ToString(bool detail)
        {
            string text = string.Empty;

            text += string.Format("{0}\n", base.ToString());
            AreaTankerModel nonDeploymentTankerCount = this.GetNonDeploymentTankerCount();

            text += string.Format("海域に未配備の輸送船数:{0}(帰港中:{1})\n", nonDeploymentTankerCount.GetCount(), nonDeploymentTankerCount.GetCountMove());
            if (detail)
            {
                text += string.Format("[--海域一覧--]\n", new object[0]);
                Dictionary <int, MapAreaModel> area = this.Area;
                using (Dictionary <int, MapAreaModel> .ValueCollection.Enumerator enumerator = area.get_Values().GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        MapAreaModel  current       = enumerator.get_Current();
                        SortieManager sortieManager = this.SelectArea(current.Id);
                        MapModel[]    maps          = sortieManager.Maps;
                        text += string.Format("{0} ", current);
                        for (int i = 0; i < maps.Length; i++)
                        {
                            MapModel mapModel = maps[i];
                            if (mapModel.Map_Possible)
                            {
                                text += string.Format("{0}-{1}{2}{3} ", new object[]
                                {
                                    mapModel.AreaId,
                                    mapModel.No,
                                    (!mapModel.Cleared) ? string.Empty : "[Clear]",
                                    (!mapModel.ClearedOnce) ? string.Empty : "!"
                                });
                            }
                            else
                            {
                                text += string.Format("({0}-{1}{2}{3}) ", new object[]
                                {
                                    mapModel.AreaId,
                                    mapModel.No,
                                    (!mapModel.Cleared) ? string.Empty : "[Clear]",
                                    (!mapModel.ClearedOnce) ? string.Empty : "!"
                                });
                            }
                        }
                        text += "\n";
                    }
                }
                text += string.Format("[--海域一覧--]", new object[0]);
            }
            return(text);
        }
Ejemplo n.º 6
0
        public bool IsValidDeploy(int area_id, int tanker_count, EscortDeckManager escort)
        {
            if (!IsValidChangeTankerCount(area_id, tanker_count))
            {
                return(false);
            }
            AreaTankerModel tankerCount = ManagerBase._area[area_id].GetTankerCount();

            if (!escort.HasChanged() && tankerCount.GetCount() == tanker_count)
            {
                return(false);
            }
            return(true);
        }
Ejemplo n.º 7
0
        public bool Deploy(int area_id, int tanker_count, EscortDeckManager escort)
        {
            AreaTankerModel tankerCount = ManagerBase._area[area_id].GetTankerCount();
            int             count       = tankerCount.GetCount();

            if (!IsValidDeploy(area_id, tanker_count, escort))
            {
                return(false);
            }
            bool flag = false;

            if (escort.HasChanged())
            {
                flag = escort.__Commit__();
            }
            Api_Result <List <Mem_tanker> > api_Result = null;

            if (count != tanker_count)
            {
                if (count > tanker_count)
                {
                    int num = count - tanker_count;
                    api_Result = new Api_req_Transport().BackTanker(area_id, num);
                }
                else if (count < tanker_count)
                {
                    int num2 = tanker_count - count;
                    api_Result = new Api_req_Transport().GoTanker(area_id, num2);
                }
            }
            if (!flag && (api_Result == null || api_Result.state != 0))
            {
                return(false);
            }
            if (flag)
            {
                base.UserInfo.__UpdateEscortDeck__(new Api_get_Member());
            }
            if (api_Result != null && api_Result.state == Api_Result_State.Success)
            {
                return(_tanker_manager.Update());
            }
            return(flag);
        }