Esempio n. 1
0
        /// <summary>
        /// Adds the new state.
        /// </summary>
        /// <param name="stateName">Name of the state.</param>
        /// <param name="stateIdentifier">The state identifier.</param>
        /// <returns></returns>
        public virtual IStateMachineStateBuilder AddNewState(string stateName, object stateIdentifier)
        {
            var newState = new StateMachineState(this, stateName, stateIdentifier);

            StateList.Add(newState);
            return(newState);
        }
Esempio n. 2
0
        /// <summary>
        /// コンストラクタ
        /// 使用するステートクラスをここで先に生成しておき、最初のステートを設定する
        /// (unityで複数のオブジェクトにアタッチされることを考慮して、シングルトンを使用せずに実装)
        /// </summary>
        public Character()
        {
            StateList.Add(new leftState());
            StateList.Add(new rightState());

            ChangeState(StateList[(int)EState.EState_leftState]);
        }
        /// <summary>
        /// Initialize a new quality table which contains all game stats.
        /// </summary>
        public QualityTable()
        {
            this.Epsilon = 0.2;
            this.Alpha   = 0.1;
            this.Gamma   = 0.1;

            this.StateList = new List <State>();

            //fill state list for hard hands
            for (int playerValue = 4; playerValue <= 22; playerValue++)
            {
                for (int dealerValue = 2; dealerValue <= 22; dealerValue++)
                {
                    StateList.Add(new State(playerValue, dealerValue, false));
                }
            }

            //fill state list for soft hands
            for (int playerValue = 12; playerValue <= 22; playerValue++)
            {
                for (int dealerValue = 2; dealerValue <= 22; dealerValue++)
                {
                    StateList.Add(new State(playerValue, dealerValue, true));
                }
            }
        }
    private void GetCurrentRess()
    {
        Ress = new StateList <Res>();

        if (_excellent == null)
        {
            _excellent             = new Excellent();
            _excellent.DateCreated = DateTime.Now.AddHours(-TrainSettings.Instance.Timezone);
        }
        foreach (Res item in _excellent.Ress)
        {
            Ress.Add(item);
        }


        //foreach (Res titem in _excellent.TempAddRess.Keys)
        //{
        //    if (_excellent.TempAddRess[titem] == "add")
        //    {
        //        Ress.Add(titem);

        //    }
        //    else
        //    {
        //        Ress.Remove(titem);

        //    }
        //}
        //Ress = _excellent.Ress;
    }
Esempio n. 5
0
        /// <summary>
        /// MExchangeテーブルの設定内容で初期化する
        /// </summary>
        public void InitializeExchange()
        {
            // 初期化
            // 資産情報
            CollateralList = InitializeDictionary(CollateralList);

            // 注文情報
            ParentOrderList = InitializeDictionary(ParentOrderList);
            ChildOrderList  = InitializeDictionary(ChildOrderList);

            // 建玉情報
            PositionList = InitializeDictionary(PositionList);

            // 取引所状態情報
            StateList = InitializeDictionary(StateList);

            // テクニカル管理
            TechnicalList = InitializeDictionary(TechnicalList);

            // クライアント
            Client = InitializeDictionary(Client);

            // パラメータ読み込み
            using (var db = new MExchangeDbContext(DbContextOptions))
            {
                // データを取得
                var mExchange = db.MExchange;

                foreach (var item in mExchange)
                {
                    if (item.Enabled == Enabled)
                    {
                        // 資産情報
                        CollateralList.Add(item.Id, new Collateral(new RawCollateral()));

                        // 注文情報
                        ParentOrderList.Add(item.Id, new List <Order>());
                        ChildOrderList.Add(item.Id, new List <Order>());

                        // 建玉情報
                        PositionList.Add(item.Id, new List <Position>());

                        // 取引所状態情報
                        StateList.Add(item.Id, new RawBoardState());

                        // テクニカル管理生成
                        Dictionary <int, PubnubManager> pubnub = null;
                        if (PubnubList.ContainsKey(item.Id))
                        {
                            pubnub = PubnubList[item.Id];
                        }
                        TechnicalList.Add(item.Id, new TechnicalManager(item.Id, pubnub, TimeScaleList, DbContextOptions, TechnicalList));

                        // 通信用クライアント生成
                        Client.Add(item.Id, new BitflyerClient(item.Id, DbContextOptions));
                    }
                }
            }
        }
Esempio n. 6
0
 public HumanStateMachine(AbsEntity entity) : base(entity)
 {
     StateList.Add(new IdleState(this));
     StateList.Add(new MoveState(this));
     StateList.Add(new SkillState(this));
     StateList.Add(new SpecialState(this));
     StateList.Add(new DeadState(this));
 }
Esempio n. 7
0
        public override void SetUpImages()
        {
            //StateList.Add(0,StaticSpriteCache.sprites[17]);
            //StateList.Add(1,StaticSpriteCache.sprites[19]);
            //StateList.Add(2,StaticSpriteCache.sprites[18]);

            StateList.Add(0, StaticSpriteCache.sprites[75]);
            StateList.Add(1, StaticSpriteCache.sprites[77]);
            StateList.Add(2, StaticSpriteCache.sprites[79]);
        }
Esempio n. 8
0
 public void SetStateItems(IEnumerable <State> states)
 {
     foreach (var state in states)
     {
         StateList.Add(new SelectListItem()
         {
             Value = state.StateID.ToString(),
             Text  = state.StateName
         });
     }
 }
Esempio n. 9
0
        /*
         * public static void AddConditionalCallback(object obj)
         * {
         *  Debug.Log("Add conditional.");
         *
         * }*/


        /// <summary>
        /// adds a state.
        /// </summary>
        /// <param name="obj"></param>
        public static void CreateStateContextCallback(object obj)
        {
            //make the passed object to a string
            //string clb = obj.ToString();
            editorDisplayWindowsState.menuData menuData = (editorDisplayWindowsState.menuData)obj;


            if (/*clb.Equals("addState") && */ GameObject != null)
            {
                SaveAllVisualStateMetaData();

                if (StateList.Count == 0)
                {
                    Debug.LogError("StateList is Empty so you can't create a state.");
                    return;
                }
                //string stateName = "aMech" + GameObject.name + "State" + utlDataAndFile.GetCode(StateList.Count);

                int    codeIndex = StateList.Count;
                string stateName = "aMech" + GameObject.name + "State" + utlDataAndFile.GetCode(codeIndex);
                while (!CreateAndAddStateCodeToProject(GameObject, stateName, menuData.m_FileAndPath, menuData.m_ReplaceName, false))
                {
                    codeIndex += 1;
                    stateName  = "aMech" + GameObject.name + "State" + utlDataAndFile.GetCode(codeIndex);
                    //sanity check
                    if (codeIndex > 10000)
                    {
                        return;
                    }
                }


                string fileAndPath = "";
                fileAndPath = utlDataAndFile.FindPathAndFileByClassName(stateName);

                stateWindowsNode windowNode = new stateWindowsNode(stateEditorUtils.StateList.Count);

                Vector3 transMousePos = new Vector3();
                transMousePos = stateEditorUtils.TranslationMtx.UnTransform(MousePos);

                windowNode.Set(fileAndPath, stateName, stateName, transMousePos.x, transMousePos.y, 150, 80);
                StateList.Add(windowNode);

                SaveStateWindowsNodeData(fileAndPath, stateName, (int)MousePos.x, (int)MousePos.y, 150, 80);

                fileAndPath = utlDataAndFile.FindPathAndFileByClassName(StateMachineName);

                SaveStateInfo(StateMachineName, GameObject.name);

                AddStateCodeToStateMachineCode(fileAndPath, stateName);
            }
        }
 /// <summary>
 /// Método para iterar sobre o hash de estados e adicioná-los à lista de estados
 /// </summary>
 public void GenerateStateList()
 {
     foreach (string key in StateHash.Keys)
     {
         GrammarState state = GrammarState.ConvertFrom(StateHash[key]);
         if (state != null)
         {
             if (!StateList.Contains(state))
             {
                 StateList.Add(state);
             }
         }
     }
 }
Esempio n. 11
0
        public void AddToList(string item)
        {
            int i;

            StateList.Clear();
            for (i = 0; i < StateNames.Count; i++)
            {
                if (StateNames[i].country == item)
                {
                    StateList.Add(new States {
                        country = StateNames[i].state, state = StateNames[i].state
                    });
                }
            }
        }
Esempio n. 12
0
        /// <summary>
        /// 获取阅览室列表
        /// </summary>
        public void GetRoomList()
        {
            _roomList = T_SM_ReadingRoom.GetReadingRooms(null, null, null);
            foreach (ReadingRoomInfo item in _roomList)
            {
                VM_UC_RoomStatus status = new VM_UC_RoomStatus();
                status.AllSeatCount = item.SeatList.Seats.Count(u => u.Value.IsSuspended == false);
                status.RoomName     = item.Name;
                status.RoomNo       = item.No;
                StateList.Add(item.No, status);
            }
            LibStatus.AllSeatCount = StateList.Sum(u => u.Value.AllSeatCount);
            LibStatus.RoomName     = _roomList[0].Libaray.Name;

            GetUsage();
            ShowTimeRun();
        }
        public Page()
        {
            InitializeComponent();
            DataContext = this;

            mw = (MainWindow)Application.Current.MainWindow;

            // Fill Country List
            foreach (string country in Countries.Names)
            {
                CountryList.Add(country);
            }

            // Fill State List
            foreach (string state in States.Abbreviations)
            {
                StateList.Add(state);
            }

            SetPageType(CurrentUser);
        }
 /// <summary>
 /// 分区域排列
 /// </summary>
 public void GetRoomArea()
 {
     try
     {
         //添加区域
         List <LibraryInfo> linList = T_SM_Library.GetLibraryInfoList(null, null, null);
         foreach (AreaInfo area in from lib in linList from area in lib.AreaList where !ReadingRoomUsage.ContainsKey(area.AreaName) select area)
         {
             ReadingRoomUsage.Add(area.AreaName, new List <ReadingRoomUC_ViewModel>());
         }
         if (!ReadingRoomUsage.ContainsKey("阅览室"))
         {
             ReadingRoomUsage.Add("阅览室", new List <ReadingRoomUC_ViewModel>());
         }
         foreach (KeyValuePair <string, ReadingRoomInfo> item in ClientObject.ReadingRoomList)
         {
             if (item.Value.Area.AreaName == "")
             {
                 item.Value.Area.AreaName = "阅览室";
             }
             ReadingRoomUC_ViewModel viewModel = new ReadingRoomUC_ViewModel();
             viewModel.ReadingRoomName = item.Value.Name;
             viewModel.ReadingRoomNo   = item.Value.No;
             viewModel.IsBook          = item.Value.Setting.SeatBespeak.Used;
             viewModel.AllSeatCount    = item.Value.SeatList.Seats.Count(u => u.Value.IsSuspended == false);
             StateList.Add(viewModel.ReadingRoomNo, viewModel);
             ReadingRoomUsage[item.Value.Area.AreaName].Add(StateList[viewModel.ReadingRoomNo]);
         }
         List <string> deleteArea = (from item in ReadingRoomUsage where item.Value.Count < 1 select item.Key).ToList();
         foreach (string a in deleteArea)
         {
             ReadingRoomUsage.Remove(a);
         }
     }
     catch (Exception ex)
     {
         WriteLog.Write("加载阅览室遇到异常" + ex.Message);
         PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.Exception);
     }
 }
Esempio n. 15
0
 public override void SetUpImages()
 {
     //StateList.Add(0, StaticSpriteCache.sprites[24]);
     StateList.Add(0, StaticSpriteCache.sprites[85]);
 }
        async Task LoadDropDownData()
        {
            List <string> liYeaNo = new List <string>();

            liYeaNo.Add("Yes");
            liYeaNo.Add("No");

            DomicileUksList          = liYeaNo;
            FreedomFightersList      = liYeaNo;
            DefencePersonalList      = liYeaNo;
            PhysicallyChallengesList = liYeaNo;
            PunishedByCourtList      = liYeaNo;
            DabarredCollegeList      = liYeaNo;
            EWS = liYeaNo;

            ExamCenterList.Add("Almora");
            ExamCenterList.Add("Bageshwar");
            ExamCenterList.Add("Haldwani");
            ExamCenterList.Add("Kashipur");
            ExamCenterList.Add("Nainital");
            ExamCenterList.Add("Pithoragarh");
            ExamCenterList.Add("Ram Nagar");
            ExamCenterList.Add("Rudrapur");
            ExamCenterList.Add("Ranikhet");
            ExamCenterList.Add("Khatima");
            ExamCenterList.Add("Dwarahat");
            ExamCenterList.Add("Lohaghat");
            ExamCenterList.Add("Kichha");
            ExamCenterList.Add("Berinag");

            GroupList.Add("Arts");
            GroupList.Add("Commerce");
            GroupList.Add("Science");

            MaritalStatusList.Add("Single");
            MaritalStatusList.Add("Married");

            NationalityList.Add("Indian");
            NationalityList.Add("Others");

            CategoryList.Add("Unreserved General");
            CategoryList.Add("Schedule Cast (SC)");
            CategoryList.Add("Schedule Tribe (ST)");
            CategoryList.Add("Other Backward Class (OBC) - Creamy");
            CategoryList.Add("Other Backward Class (OBC) - Non Creamy");

            PhysicallyChallengesTypeList.Add("Physically Challenged");
            PhysicallyChallengesTypeList.Add("Visually Challenged");
            PhysicallyChallengesTypeList.Add("None");

            GendersList.Add("Male");
            GendersList.Add("Female");
            GendersList.Add("Transgender");

            StreamList.Add("Humanities/Arts");
            StreamList.Add("Commerce");
            StreamList.Add("Science");

            CoursesList.Add("Bachelor of Education");
            CoursesList.Add("Master of Education");

            PassingYearList.Add("Appearing");
            PassingYearList.Add("2020");
            PassingYearList.Add("2019");
            PassingYearList.Add("2018");
            PassingYearList.Add("2017");
            PassingYearList.Add("2016");
            PassingYearList.Add("2015");
            PassingYearList.Add("2014");
            PassingYearList.Add("2013");
            PassingYearList.Add("2012");
            PassingYearList.Add("2011");
            PassingYearList.Add("2010");

            M_EdGraducationRequired.Add("B.Ed. Theory");
            M_EdGraducationRequired.Add("B.T. Theory");
            M_EdGraducationRequired.Add("L.T. Theory");
            M_EdGraducationRequired.Add("B.EI.Ed. Theory");
            M_EdGraducationRequired.Add("D.EI.Ed. Theory");
            M_EdGraducationRequired.Add("B.A B.Ed. Theory");
            M_EdGraducationRequired.Add("B.Sc. B.Ed. Theory");

            var response = await _httpClient.GetAsync("https://api.covidindiatracker.com/state_data.json");

            if (response.IsSuccessStatusCode)
            {
                var result =
                    Newtonsoft.Json.JsonConvert.DeserializeObject <IEnumerable <StateData> >(
                        await response.Content.ReadAsStringAsync());
                foreach (var state in result)
                {
                    StateList.Add(state.state);
                }
            }
        }
Esempio n. 17
0
 private void SetSectionAIDetail_OLD()
 {
     Faction faction;
     int num2;
     int threat;
     GameObjectList sectionNoOrientationAutoAIDetailsByConditions;
     int num5;
     GameObjectList list5;
     if (this.SectionCount <= 1)
     {
         num5 = ((this.FirstSection.ArchitectureScale / 2) - (this.FirstSection.ArchitectureCount / 2)) + 1;
         if (this.ArmyScale < (num5 * 6))
         {
             if (!this.Capital.IsOK())
             {
                 sectionNoOrientationAutoAIDetailsByConditions = base.Scenario.GameCommonData.AllSectionAIDetails.GetSectionAIDetailsByConditions(SectionOrientationKind.无, true, false, false, false, false);
                 if (sectionNoOrientationAutoAIDetailsByConditions.Count > 0)
                 {
                     this.FirstSection.AIDetail = sectionNoOrientationAutoAIDetailsByConditions[GameObject.Random(sectionNoOrientationAutoAIDetailsByConditions.Count)] as SectionAIDetail;
                 }
             }
             else
             {
                 sectionNoOrientationAutoAIDetailsByConditions = base.Scenario.GameCommonData.AllSectionAIDetails.GetSectionNoOrientationAutoAIDetailsByConditions(false, true);
                 if (sectionNoOrientationAutoAIDetailsByConditions.Count > 0)
                 {
                     this.FirstSection.AIDetail = sectionNoOrientationAutoAIDetailsByConditions[GameObject.Random(sectionNoOrientationAutoAIDetailsByConditions.Count)] as SectionAIDetail;
                 }
             }
             return;
         }
         if (this.ArmyScale < (num5 * 12))
         {
             if (!this.Capital.IsOK())
             {
                 sectionNoOrientationAutoAIDetailsByConditions = base.Scenario.GameCommonData.AllSectionAIDetails.GetSectionAIDetailsByConditions(SectionOrientationKind.无, true, false, false, false, false);
                 if (sectionNoOrientationAutoAIDetailsByConditions.Count > 0)
                 {
                     this.FirstSection.AIDetail = sectionNoOrientationAutoAIDetailsByConditions[GameObject.Random(sectionNoOrientationAutoAIDetailsByConditions.Count)] as SectionAIDetail;
                 }
             }
             else
             {
                 sectionNoOrientationAutoAIDetailsByConditions = base.Scenario.GameCommonData.AllSectionAIDetails.GetSectionNoOrientationAutoAIDetailsByConditions(false, true);
                 if (sectionNoOrientationAutoAIDetailsByConditions.Count > 0)
                 {
                     this.FirstSection.AIDetail = sectionNoOrientationAutoAIDetailsByConditions[GameObject.Random(sectionNoOrientationAutoAIDetailsByConditions.Count)] as SectionAIDetail;
                 }
             }
             return;
         }
         if (this.ArmyScale < (num5 * 20))
         {
             if (!this.Capital.IsOK())
             {
                 sectionNoOrientationAutoAIDetailsByConditions = base.Scenario.GameCommonData.AllSectionAIDetails.GetSectionAIDetailsByConditions(SectionOrientationKind.无, true, false, false, false, false);
                 if (sectionNoOrientationAutoAIDetailsByConditions.Count > 0)
                 {
                     this.FirstSection.AIDetail = sectionNoOrientationAutoAIDetailsByConditions[GameObject.Random(sectionNoOrientationAutoAIDetailsByConditions.Count)] as SectionAIDetail;
                 }
             }
             else
             {
                 sectionNoOrientationAutoAIDetailsByConditions = base.Scenario.GameCommonData.AllSectionAIDetails.GetSectionNoOrientationAutoAIDetailsByConditions(true, true);
                 if (sectionNoOrientationAutoAIDetailsByConditions.Count > 0)
                 {
                     this.FirstSection.AIDetail = sectionNoOrientationAutoAIDetailsByConditions[GameObject.Random(sectionNoOrientationAutoAIDetailsByConditions.Count)] as SectionAIDetail;
                 }
             }
             return;
         }
         if (this.ArmyScale >= (num5 * 30))
         {
             if (!this.Capital.IsGood())
             {
                 sectionNoOrientationAutoAIDetailsByConditions = base.Scenario.GameCommonData.AllSectionAIDetails.GetSectionNoOrientationAutoAIDetailsByConditions(true, false);
                 if (sectionNoOrientationAutoAIDetailsByConditions.Count > 0)
                 {
                     this.FirstSection.AIDetail = sectionNoOrientationAutoAIDetailsByConditions[GameObject.Random(sectionNoOrientationAutoAIDetailsByConditions.Count)] as SectionAIDetail;
                 }
                 return;
             }
             faction = null;
             num2 = -2147483648;
             foreach (Faction faction2 in base.Scenario.Factions.GetRandomList())
             {
                 if (((faction2 != this) && !this.IsFriendly(faction2)) && (faction2.Capital != null))
                 {
                     threat = this.GetThreat(faction2);
                     if ((threat > num2) || GameObject.Chance(20))
                     {
                         num2 = threat;
                         faction = faction2;
                     }
                 }
             }
             if ((faction != null) && (this.FirstSection.OrientationFaction != faction))
             {
                 foreach (Architecture architecture in this.Architectures)
                 {
                     if (architecture.HasFactionInClose(faction, 1))
                     {
                         sectionNoOrientationAutoAIDetailsByConditions = base.Scenario.GameCommonData.AllSectionAIDetails.GetSectionAIDetailsByConditions(SectionOrientationKind.势力, true, true, true, false, true);
                         if (sectionNoOrientationAutoAIDetailsByConditions.Count > 0)
                         {
                             this.FirstSection.AIDetail = sectionNoOrientationAutoAIDetailsByConditions[GameObject.Random(sectionNoOrientationAutoAIDetailsByConditions.Count)] as SectionAIDetail;
                             this.FirstSection.OrientationFaction = faction;
                         }
                         break;
                     }
                 }
             }
             list5 = base.Scenario.GameCommonData.AllSectionAIDetails.GetSectionAIDetailsByConditions(SectionOrientationKind.州域, true, true, true, false, true);
             if (list5.Count > 0)
             {
                 this.FirstSection.AIDetail = list5[GameObject.Random(list5.Count)] as SectionAIDetail;
                 if (this.Capital.LocationState.GetFactionScale(this) < 100)
                 {
                     this.FirstSection.OrientationState = this.Capital.LocationState;
                 }
                 else
                 {
                     this.FirstSection.OrientationState = this.Capital.LocationState.ContactStates[GameObject.Random(this.Capital.LocationState.ContactStates.Count)] as State;
                 }
             }
             return;
         }
         if (!this.Capital.IsGood())
         {
             sectionNoOrientationAutoAIDetailsByConditions = base.Scenario.GameCommonData.AllSectionAIDetails.GetSectionNoOrientationAutoAIDetailsByConditions(true, false);
             if (sectionNoOrientationAutoAIDetailsByConditions.Count > 0)
             {
                 this.FirstSection.AIDetail = sectionNoOrientationAutoAIDetailsByConditions[GameObject.Random(sectionNoOrientationAutoAIDetailsByConditions.Count)] as SectionAIDetail;
             }
             return;
         }
         faction = null;
         num2 = -2147483648;
         foreach (Faction faction2 in this.GetUnderZeroDiplomaticRelationFactions().GetRandomList())
         {
             threat = this.GetThreat(faction2);
             if ((threat > num2) || GameObject.Chance(20))
             {
                 num2 = threat;
                 faction = faction2;
             }
         }
         if ((faction != null) && (this.FirstSection.OrientationFaction != faction))
         {
             foreach (Architecture architecture in this.Architectures)
             {
                 if (architecture.HasFactionInClose(faction, 1))
                 {
                     sectionNoOrientationAutoAIDetailsByConditions = base.Scenario.GameCommonData.AllSectionAIDetails.GetSectionAIDetailsByConditions(SectionOrientationKind.势力, true, true, true, false, true);
                     if (sectionNoOrientationAutoAIDetailsByConditions.Count > 0)
                     {
                         this.FirstSection.AIDetail = sectionNoOrientationAutoAIDetailsByConditions[GameObject.Random(sectionNoOrientationAutoAIDetailsByConditions.Count)] as SectionAIDetail;
                         this.FirstSection.OrientationFaction = faction;
                     }
                     break;
                 }
             }
         }
     }
     else
     {
         int num = (this.ArmyScale / 60) - (int)this.Leader.StrategyTendency;
         if (num <= 0)
         {
             foreach (Section section in this.Sections)
             {
                 if (section.AIDetail.OrientationKind == SectionOrientationKind.无)
                 {
                     Section section2;
                     num5 = this.FirstSection.ArchitectureScale - (this.FirstSection.ArchitectureCount / 2);
                     if (section.GetHostileScale() > 0)
                     {
                         if (section.ArmyScale > (num5 * 6))
                         {
                             foreach (Architecture architecture in section.Architectures)
                             {
                                 section2 = null;
                                 if (architecture.HasOffensiveSectionInClose(out section2, 1))
                                 {
                                     sectionNoOrientationAutoAIDetailsByConditions = base.Scenario.GameCommonData.AllSectionAIDetails.GetSectionAIDetailsByConditions(SectionOrientationKind.军区, true, false, false, true, true);
                                     if (sectionNoOrientationAutoAIDetailsByConditions.Count > 0)
                                     {
                                         section.AIDetail = sectionNoOrientationAutoAIDetailsByConditions[GameObject.Random(sectionNoOrientationAutoAIDetailsByConditions.Count)] as SectionAIDetail;
                                         section.OrientationSection = section2;
                                     }
                                     break;
                                 }
                             }
                             if (section.OrientationSection == null)
                             {
                                 sectionNoOrientationAutoAIDetailsByConditions = base.Scenario.GameCommonData.AllSectionAIDetails.GetSectionNoOrientationAutoAIDetailsByConditions(true, true);
                                 if (sectionNoOrientationAutoAIDetailsByConditions.Count > 0)
                                 {
                                     this.FirstSection.AIDetail = sectionNoOrientationAutoAIDetailsByConditions[GameObject.Random(sectionNoOrientationAutoAIDetailsByConditions.Count)] as SectionAIDetail;
                                 }
                             }
                         }
                         else
                         {
                             sectionNoOrientationAutoAIDetailsByConditions = base.Scenario.GameCommonData.AllSectionAIDetails.GetSectionNoOrientationAutoAIDetailsByConditions(false, true);
                             if (sectionNoOrientationAutoAIDetailsByConditions.Count > 0)
                             {
                                 this.FirstSection.AIDetail = sectionNoOrientationAutoAIDetailsByConditions[GameObject.Random(sectionNoOrientationAutoAIDetailsByConditions.Count)] as SectionAIDetail;
                             }
                         }
                     }
                     else if ((section.GetFrontScale() > 0) && (section.ArmyScale < (num5 * 6)))
                     {
                         sectionNoOrientationAutoAIDetailsByConditions = base.Scenario.GameCommonData.AllSectionAIDetails.GetSectionNoOrientationAutoAIDetailsByConditions(true, false);
                         if (sectionNoOrientationAutoAIDetailsByConditions.Count > 0)
                         {
                             this.FirstSection.AIDetail = sectionNoOrientationAutoAIDetailsByConditions[GameObject.Random(sectionNoOrientationAutoAIDetailsByConditions.Count)] as SectionAIDetail;
                         }
                     }
                     else
                     {
                         foreach (Architecture architecture in section.Architectures)
                         {
                             section2 = null;
                             if (architecture.HasOffensiveSectionInClose(out section2, 1))
                             {
                                 sectionNoOrientationAutoAIDetailsByConditions = base.Scenario.GameCommonData.AllSectionAIDetails.GetSectionAIDetailsByConditions(SectionOrientationKind.军区, true, false, false, false, false);
                                 if (sectionNoOrientationAutoAIDetailsByConditions.Count > 0)
                                 {
                                     section.AIDetail = sectionNoOrientationAutoAIDetailsByConditions[GameObject.Random(sectionNoOrientationAutoAIDetailsByConditions.Count)] as SectionAIDetail;
                                     section.OrientationSection = section2;
                                 }
                                 break;
                             }
                         }
                         if (section.OrientationSection == null)
                         {
                             sectionNoOrientationAutoAIDetailsByConditions = base.Scenario.GameCommonData.AllSectionAIDetails.GetSectionNoOrientationAutoAIDetailsByConditions(false, false);
                             if (sectionNoOrientationAutoAIDetailsByConditions.Count > 0)
                             {
                                 this.FirstSection.AIDetail = sectionNoOrientationAutoAIDetailsByConditions[GameObject.Random(sectionNoOrientationAutoAIDetailsByConditions.Count)] as SectionAIDetail;
                             }
                         }
                     }
                 }
             }
             return;
         }
         faction = null;
         num2 = -2147483648;
         int num3 = 0;
         foreach (Faction faction2 in this.GetUnderZeroDiplomaticRelationFactions().GetRandomList())
         {
             threat = this.GetThreat(faction2);
             if ((threat > num2) || GameObject.Chance(20))
             {
                 num2 = threat;
                 faction = faction2;
             }
         }
         GameObjectList list = this.Sections.GetList();
         list.PropertyName = "ArmyScale";
         list.IsNumber = true;
         list.ReSort();
         if (faction != null)
         {
             foreach (Section section in list)
             {
                 if (section.ArmyScale < 0x19)
                 {
                     break;
                 }
                 foreach (Architecture architecture in section.Architectures)
                 {
                     if (architecture.HasFactionInClose(faction, 1))
                     {
                         sectionNoOrientationAutoAIDetailsByConditions = base.Scenario.GameCommonData.AllSectionAIDetails.GetSectionAIDetailsByConditions(SectionOrientationKind.势力, true, true, true, false, true);
                         if (sectionNoOrientationAutoAIDetailsByConditions.Count > 0)
                         {
                             section.AIDetail = sectionNoOrientationAutoAIDetailsByConditions[GameObject.Random(sectionNoOrientationAutoAIDetailsByConditions.Count)] as SectionAIDetail;
                             section.OrientationFaction = faction;
                             num3++;
                         }
                         break;
                     }
                 }
                 if (num3 >= num)
                 {
                     break;
                 }
             }
             return;
         }
         if (this.Capital.LocationState.GetFactionScale(this) < 100)
         {
             foreach (Section section in list)
             {
                 if (section.ArmyScale < 0x19)
                 {
                     break;
                 }
                 if (this.Capital.LocationState.GetSectionScale(section) >= 60)
                 {
                     sectionNoOrientationAutoAIDetailsByConditions = base.Scenario.GameCommonData.AllSectionAIDetails.GetSectionAIDetailsByConditions(SectionOrientationKind.州域, true, true, true, false, true);
                     if (sectionNoOrientationAutoAIDetailsByConditions.Count > 0)
                     {
                         section.AIDetail = sectionNoOrientationAutoAIDetailsByConditions[GameObject.Random(sectionNoOrientationAutoAIDetailsByConditions.Count)] as SectionAIDetail;
                         section.OrientationState = this.Capital.LocationState;
                         num3++;
                     }
                     if (num3 >= num)
                     {
                         break;
                     }
                 }
             }
             return;
         }
         if (this.Capital.LocationState.LinkedRegion.GetFactionScale(this) < 100)
         {
             foreach (Section section in list)
             {
                 if (section.ArmyScale < 0x19)
                 {
                     break;
                 }
                 if (this.Capital.LocationState.LinkedRegion.GetSectionScale(section) >= 60)
                 {
                     sectionNoOrientationAutoAIDetailsByConditions = base.Scenario.GameCommonData.AllSectionAIDetails.GetSectionAIDetailsByConditions(SectionOrientationKind.州域, true, true, true, false, true);
                     if (sectionNoOrientationAutoAIDetailsByConditions.Count > 0)
                     {
                         section.AIDetail = sectionNoOrientationAutoAIDetailsByConditions[GameObject.Random(sectionNoOrientationAutoAIDetailsByConditions.Count)] as SectionAIDetail;
                         foreach (Architecture architecture in section.Architectures)
                         {
                             if (architecture.LocationState.LinkedRegion == this.Capital.LocationState.LinkedRegion)
                             {
                                 section.OrientationState = architecture.LocationState;
                                 break;
                             }
                         }
                         num3++;
                     }
                     if (num3 >= num)
                     {
                         break;
                     }
                 }
             }
             return;
         }
         StateList list3 = new StateList();
         foreach (State state in this.Capital.LocationState.LinkedRegion.States)
         {
             foreach (State state2 in state.ContactStates)
             {
                 if ((state2.LinkedRegion != this.Capital.LocationState.LinkedRegion) && (state2.GetFactionScale(this) < 100))
                 {
                     list3.Add(state2);
                 }
             }
         }
         if (list3.Count > 0)
         {
             foreach (Section section in list)
             {
                 if (section.ArmyScale < 0x19)
                 {
                     break;
                 }
                 if (this.Capital.LocationState.LinkedRegion.GetSectionScale(section) >= 60)
                 {
                     sectionNoOrientationAutoAIDetailsByConditions = base.Scenario.GameCommonData.AllSectionAIDetails.GetSectionAIDetailsByConditions(SectionOrientationKind.州域, true, true, true, false, true);
                     if (sectionNoOrientationAutoAIDetailsByConditions.Count > 0)
                     {
                         section.AIDetail = sectionNoOrientationAutoAIDetailsByConditions[GameObject.Random(sectionNoOrientationAutoAIDetailsByConditions.Count)] as SectionAIDetail;
                         section.OrientationState = list3[GameObject.Random(list3.Count)] as State;
                         num3++;
                     }
                     if (num3 >= num)
                     {
                         break;
                     }
                 }
             }
         }
         if (num3 < num)
         {
             foreach (Section section in list)
             {
                 if (section.ArmyScale < 0x19)
                 {
                     return;
                 }
                 if (this.Capital.LocationState.LinkedRegion.GetSectionScale(section) <= 0)
                 {
                     Architecture maxPopulationArchitecture = section.MaxPopulationArchitecture;
                     if (maxPopulationArchitecture != null)
                     {
                         StateList list4 = new StateList();
                         foreach (State state3 in maxPopulationArchitecture.LocationState.ContactStates)
                         {
                             if ((state3.LinkedRegion != this.Capital.LocationState.LinkedRegion) && (state3.GetFactionScale(this) < 100))
                             {
                                 list4.Add(state3);
                             }
                         }
                         if (list4.Count > 0)
                         {
                             sectionNoOrientationAutoAIDetailsByConditions = base.Scenario.GameCommonData.AllSectionAIDetails.GetSectionAIDetailsByConditions(SectionOrientationKind.州域, true, true, true, false, true);
                             if (sectionNoOrientationAutoAIDetailsByConditions.Count > 0)
                             {
                                 section.AIDetail = sectionNoOrientationAutoAIDetailsByConditions[GameObject.Random(sectionNoOrientationAutoAIDetailsByConditions.Count)] as SectionAIDetail;
                                 section.OrientationState = list4[GameObject.Random(list4.Count)] as State;
                                 num3++;
                             }
                             if (num3 >= num)
                             {
                                 return;
                             }
                         }
                     }
                 }
             }
         }
         return;
     }
     list5 = base.Scenario.GameCommonData.AllSectionAIDetails.GetSectionAIDetailsByConditions(SectionOrientationKind.州域, true, true, true, false, true);
     if (list5.Count > 0)
     {
         this.FirstSection.AIDetail = list5[GameObject.Random(list5.Count)] as SectionAIDetail;
         if (this.Capital.LocationState.GetFactionScale(this) < 100)
         {
             this.FirstSection.OrientationState = this.Capital.LocationState;
         }
         else
         {
             this.FirstSection.OrientationState = this.Capital.LocationState.ContactStates[GameObject.Random(this.Capital.LocationState.ContactStates.Count)] as State;
         }
     }
 }
Esempio n. 18
0
        /// <summary>
        /// Construtor default de um automato de gramática. Criado a partir da gramática setada em Symbol.
        /// </summary>
        public GrammarDeterministicAutomata()
        {
            GrammarNonDeterministicAutomata nonDeterministic = new GrammarNonDeterministicAutomata();

            //Cria uma referência aos terminais para comparações
            Dictionary <string, Terminal>    terminalHash    = Symbol.TerminalHash;
            Dictionary <string, NonTerminal> nonTerminalHash = Symbol.NonTerminalHash;

            GrammarState initialState = GrammarState.ConvertFrom(nonDeterministic.InitialState);

            Dictionary <GrammarState, GrammarPowerSet> hash = new Dictionary <GrammarState, GrammarPowerSet>();

            List <Symbol> transictionList = new List <Symbol>();

            transictionList.AddRange(Symbol.TerminalList);
            transictionList.AddRange(Symbol.NonTerminalList);

            //Retorna com o hash completo com todos os fechos
            GrammarPowerSet initialPowerSet = GeneratePowerSet(initialState, transictionList, Terminal.Empty, hash);

            //Carrega o valor do estado do primeiro fecho transitivo
            initialState = initialPowerSet.PowerSetToState();

            //Carrega a lista com os estados do fecho transitivo criado
            List <GrammarState> stateList = new List <GrammarState>();

            foreach (GrammarState state in hash.Keys)
            {
                GrammarPowerSet powerSet = hash[state];
                stateList.Add(powerSet.PowerSetToState());
            }

            InitialState = initialPowerSet.PowerSetToState();
            //StateList = stateList;
            foreach (GrammarState state in stateList)
            {
                StateList.Add(state.ConvertTo());
                StateHash.Add(state.StateValue, state);
            }
            TransictionList = transictionList;
            NullSymbol      = Terminal.Empty;

            #region código abandonado
            //List<Symbol> transictionList = new List<Symbol>();
            //foreach (string name in terminalHash.Keys)
            //{
            //    transictionList.Add(terminalHash[name]);
            //}
            //foreach (string name in nonTerminalHash.Keys)
            //{
            //    transictionList.Add(nonTerminalHash[name]);
            //}

            //Automata<string, Symbol> afd = Automata<string, Symbol>.AFNtoAFD(afn, transictionList, Terminal.Empty);

            //InitialState = afd.InitialState;
            //StateList = afd.StateList;
            //TransictionList = afd.TransictionList;
            //NullSymbol = afd.NullSymbol;

            ////Popular o hash
            //foreach(State<string, Symbol> afdState in StateList)
            //{
            //    StateHash.Add(afdState.StateValue, afdState);
            //}
            #endregion
        }
    private void GetCurrentRess()
    {
        Ress = new StateList<Res>();

        if (_excellent == null)
        {
            _excellent = new Excellent();
            _excellent.DateCreated = DateTime.Now.AddHours(-TrainSettings.Instance.Timezone);

        }
        foreach (Res item in _excellent.Ress)
        {
            Ress.Add(item);
        }

        //foreach (Res titem in _excellent.TempAddRess.Keys)
        //{
        //    if (_excellent.TempAddRess[titem] == "add")
        //    {
        //        Ress.Add(titem);

        //    }
        //    else
        //    {
        //        Ress.Remove(titem);

        //    }
        //}
        //Ress = _excellent.Ress;
    }