コード例 #1
0
 internal static void SyncTurnEventWidget(
     GameSession game,
     string panelName,
     TurnEvent turnEvent)
 {
     if (turnEvent == null)
     {
         game.UI.SetPropertyString("turnEventMessage", "text", "");
         game.UI.SetPropertyString("turnEventImage", "sprite", "");
         game.UI.SetVisible("turnEventNext", false);
         game.UI.SetVisible("turnEventPrevious", false);
     }
     else
     {
         game.UI.SetPropertyString("turnEventMessage", "text", turnEvent.GetEventMessage(game));
         game.UI.SetPropertyString("turnEventImage", "texture", TurnEvent.GetTurnEventSprite(game, turnEvent));
         game.UI.SetVisible("turnEventNext", true);
         game.UI.SetVisible("turnEventPrevious", true);
     }
 }
コード例 #2
0
        private void SyncTurns(int from, int to)
        {
            int    userItemId = 0;
            int    num        = -1;
            string str        = "";

            this._app.UI.ClearItems(this._app.UI.Path(this.ID, "eventList"));
            IEnumerable <TurnEvent> source = this._app.GameDatabase.GetTurnEventsByPlayerID(this._app.LocalPlayer.ID).Where <TurnEvent>((Func <TurnEvent, bool>)(x =>
            {
                if (x.TurnNumber >= from)
                {
                    return(x.TurnNumber <= to);
                }
                return(false);
            }));

            if (source.Count <TurnEvent>() == 0)
            {
                return;
            }
            foreach (TurnEvent e in source.Reverse <TurnEvent>())
            {
                if (num != e.TurnNumber)
                {
                    this._app.UI.AddItem(this._app.UI.Path(this.ID, "eventList"), "", e.TurnNumber, "");
                    str = this._app.UI.GetItemGlobalID(this._app.UI.Path(this.ID, "eventList"), "", e.TurnNumber, "");
                    this._app.UI.SetPropertyString(this._app.UI.Path(str, "turnNumber"), "text", App.Localize("@TURN") + " " + e.TurnNumber.ToString());
                    num = e.TurnNumber;
                }
                string eventMessage = e.GetEventMessage(this._app.Game);
                this._app.UI.AddItem(this._app.UI.Path(str, "eventItemList"), "", userItemId, "");
                string itemGlobalId = this._app.UI.GetItemGlobalID(this._app.UI.Path(str, "eventItemList"), "", userItemId, "");
                this._app.UI.SetPropertyString(this._app.UI.Path(itemGlobalId, "eventInfo"), "text", eventMessage);
                this._app.UI.SetPropertyString(this._app.UI.Path(itemGlobalId, "eventImage"), "texture", TurnEvent.GetTurnEventSprite(this._app.Game, e));
                ++userItemId;
            }
        }