コード例 #1
0
		private void UpdateCombatList()
		{
			if (!this._app.Game.GetPendingCombats().Any<PendingCombat>((Func<PendingCombat, bool>)(x => this._listedcombats.Any<PendingCombat>((Func<PendingCombat, bool>)(j => j.ConflictID == x.ConflictID)))))
			{
				this._listedcombats.Clear();
				foreach (SystemWidget systemWidget in this._systemWidgets)
					systemWidget.Terminate();
				this._systemWidgets.Clear();
				this._app.UI.ClearItems(this._app.UI.Path(this.ID, "contentList"));
			}
			foreach (PendingCombat pendingCombat in this._app.Game.GetPendingCombats())
			{
				PendingCombat cmb = pendingCombat;
				bool flag1 = this._app.Game.CombatData.GetCombat(this._app.GameDatabase, cmb.ConflictID, cmb.SystemID, this._app.GameDatabase.GetTurnCount()) != null;
				string itemGlobalId1;
				if (this._listedcombats.Any<PendingCombat>((Func<PendingCombat, bool>)(x => x.ConflictID == cmb.ConflictID)))
				{
					if (this._listedcombats.FirstOrDefault<PendingCombat>((Func<PendingCombat, bool>)(x => x.ConflictID == cmb.ConflictID)).complete != flag1)
					{
						this._listedcombats.FirstOrDefault<PendingCombat>((Func<PendingCombat, bool>)(x => x.ConflictID == cmb.ConflictID)).complete = flag1;
						itemGlobalId1 = this._app.UI.GetItemGlobalID(this._app.UI.Path(this.ID, "contentList"), "", cmb.ConflictID, "");
						this._listedcombats.Remove(this._listedcombats.FirstOrDefault<PendingCombat>((Func<PendingCombat, bool>)(x => x.ConflictID == cmb.ConflictID)));
					}
					else
						continue;
				}
				else
				{
					this._app.UI.AddItem(this._app.UI.Path(this.ID, "contentList"), "", cmb.ConflictID, "");
					itemGlobalId1 = this._app.UI.GetItemGlobalID(this._app.UI.Path(this.ID, "contentList"), "", cmb.ConflictID, "");
					this._app.GameDatabase.GetStarSystemInfo(cmb.SystemID);
					this._listedcombats.Add(cmb);
					this._app.UI.ClearItems(this._app.UI.Path(itemGlobalId1, "combatPlayers"));
					bool flag2 = StarMap.IsInRange(this._app.GameDatabase, this._app.LocalPlayer.ID, cmb.SystemID);
					foreach (int num in cmb.PlayersInCombat)
					{
						this._app.UI.AddItem(this._app.UI.Path(itemGlobalId1, "combatPlayers"), "", num, "");
						string itemGlobalId2 = this._app.UI.GetItemGlobalID(this._app.UI.Path(itemGlobalId1, "combatPlayers"), "", num, "");
						this._app.UI.SetPropertyString(this._app.UI.Path(itemGlobalId2, "smallAvatar"), "sprite", Path.GetFileNameWithoutExtension(this._app.GameDatabase.GetPlayerInfo(num).AvatarAssetPath));
						if (flag2 && Path.GetFileNameWithoutExtension(this._app.GameDatabase.GetPlayerInfo(num).AvatarAssetPath) != string.Empty)
						{
							this._app.UI.SetVisible(this._app.UI.Path(itemGlobalId2, "smallAvatar"), true);
							this._app.UI.SetVisible(this._app.UI.Path(itemGlobalId2, "UnknownText"), false);
						}
						else
						{
							this._app.UI.SetVisible(this._app.UI.Path(itemGlobalId2, "smallAvatar"), false);
							this._app.UI.SetVisible(this._app.UI.Path(itemGlobalId2, "UnknownText"), true);
						}
						CombatState.SetPlayerCardOutlineColor(this._app, this._app.UI.Path(itemGlobalId2, "bgPlayerColor"), flag2 ? this._app.GameDatabase.GetPlayerInfo(num).PrimaryColor : new Vector3(0.0f, 0.0f, 0.0f));
					}
					this._app.UI.ClearItems(this._app.UI.Path(itemGlobalId1, "remainingPlayers"));
					foreach (int num in cmb.NPCPlayersInCombat)
					{
						this._app.UI.AddItem(this._app.UI.Path(itemGlobalId1, "remainingPlayers"), "", num, "");
						string itemGlobalId2 = this._app.UI.GetItemGlobalID(this._app.UI.Path(itemGlobalId1, "remainingPlayers"), "", num, "");
						this._app.UI.SetPropertyString(this._app.UI.Path(itemGlobalId2, "smallAvatar"), "sprite", Path.GetFileNameWithoutExtension(this._app.GameDatabase.GetPlayerInfo(num).AvatarAssetPath));
						if (flag2 && Path.GetFileNameWithoutExtension(this._app.GameDatabase.GetPlayerInfo(num).AvatarAssetPath) != string.Empty)
						{
							this._app.UI.SetVisible(this._app.UI.Path(itemGlobalId2, "smallAvatar"), true);
							this._app.UI.SetVisible(this._app.UI.Path(itemGlobalId2, "UnknownText"), false);
						}
						else
						{
							this._app.UI.SetVisible(this._app.UI.Path(itemGlobalId2, "smallAvatar"), false);
							this._app.UI.SetVisible(this._app.UI.Path(itemGlobalId2, "UnknownText"), true);
						}
						CombatState.SetPlayerCardOutlineColor(this._app, this._app.UI.Path(itemGlobalId2, "bgPlayerColor"), flag2 ? this._app.GameDatabase.GetPlayerInfo(num).PrimaryColor : new Vector3(0.0f, 0.0f, 0.0f));
					}
					this.SyncSystemOwnershipEffect(this._app.UI.Path(itemGlobalId1, "systemTitleCard"), cmb.SystemID, !flag2);
				}
				this._app.UI.SetVisible(this._app.UI.Path(itemGlobalId1, "pendingBG"), (!flag1 ? 1 : 0) != 0);
				this._app.UI.SetVisible(this._app.UI.Path(itemGlobalId1, "completeBG"), (flag1 ? 1 : 0) != 0);
				bool isMultiplayer = this._app.GameSetup.IsMultiplayer;
				this._app.UI.SetVisible(this._app.UI.Path(itemGlobalId1, "simWidget"), false);
				string text = "PENDING";
				if (this._app.CurrentState == this._app.GetGameState<CommonCombatState>() || this._app.CurrentState == this._app.GetGameState<SimCombatState>())
				{
					CommonCombatState currentState = (CommonCombatState)this._app.CurrentState;
					if (currentState != null && currentState.GetCombatID() == cmb.ConflictID)
					{
						if (currentState.PlayersInCombat.Any<Player>((Func<Player, bool>)(x => x.ID == this._app.LocalPlayer.ID)))
							text = "RESOLVING";
						this._app.UI.SetVisible(this._app.UI.Path(itemGlobalId1, "simWidget"), true);
					}
				}
				if (isMultiplayer)
					text = "RESOLVING";
				if (flag1)
					text = "RESOLVED";
				this._app.UI.SetText(this._app.UI.Path(itemGlobalId1, "reolvetext"), text);
				this._app.UI.SetText(this._app.UI.Path(this.ID, "combatsremaininglbl"), this._listedcombats.Where<PendingCombat>((Func<PendingCombat, bool>)(x => !x.complete)).Count<PendingCombat>().ToString() + (this._listedcombats.Where<PendingCombat>((Func<PendingCombat, bool>)(x => !x.complete)).Count<PendingCombat>() != 1 ? " Combats" : " Combat") + " Pending");
			}
		}