Example #1
0
        private void OnEnable()
        {
            PartyModel        party      = AmbitionApp.GetModel <PartyModel>();
            CharacterModel    characters = AmbitionApp.GetModel <CharacterModel>();
            CalendarEvent     cEvent     = party.Party as CalendarEvent ?? characters.Rendezvous as CalendarEvent;
            FactionType       faction    = FactionType.None;
            LocalizationModel loc        = AmbitionApp.GetModel <LocalizationModel>();
            int exhaustion = AmbitionApp.Game.Exhaustion;

            int[] penalties = AmbitionApp.Game.ExhaustionPenalties;
            int   exhaustionPenalty;

            LoadOutGameObject.SetActive(cEvent != null);

            if (cEvent is PartyVO)
            {
                string      str  = AmbitionApp.Localize(PartyConstants.PARTY_DESCRIPTION + cEvent.ID);
                PartyVO     pty  = (PartyVO)cEvent;
                CharacterVO host = characters.GetCharacter(pty.Host);
                NameText.text        = loc.GetPartyName(pty);
                ButtonText.text      = AmbitionApp.Localize("calendar.btn.party");
                faction              = (cEvent as PartyVO).Faction;
                DescriptionText.text = string.IsNullOrEmpty(str)
                    ? loc.GetFormalName(host, pty.Host) + " " + loc.GetPartyInvitation(pty, host)
                    : str;
                TooltipText.text = AmbitionApp.Localize("party_" + faction.ToString().ToLower() + "_likes_and_dislikes");
            }
            else if (cEvent is RendezVO)
            {
                CharacterVO character = characters.GetCharacter(((RendezVO)cEvent).Character);
                faction              = character?.Faction ?? FactionType.None;
                NameText.text        = AmbitionApp.Localize(CharacterConsts.LOC_NAME + cEvent.ID);
                ButtonText.text      = AmbitionApp.Localize("calendar.btn.rendezvous");
                DescriptionText.text = AmbitionApp.Localize(ParisConsts.DESCRIPTION + (cEvent as RendezVO).Location);
                TooltipText.text     = AmbitionApp.Localize("rendezvous_" + faction.ToString().ToLower() + "_likes_and_dislikes");
            }
            else
            {
                TooltipText.text = null;
            }

            FactionSymbol.enabled = faction != FactionType.None;
            PlayerStatus.gameObject.SetActive(exhaustion != 0);
            ExhaustionLabel.text = AmbitionApp.Localize(exhaustion > 0 ? EXHAUSTED_LOC : WELL_RESTED_LOC);
            exhaustionPenalty    = exhaustion < 0
                ? AmbitionApp.Game.WellRestedBonus
                : exhaustion >= penalties.Length
                ? penalties[penalties.Length - 1]
                : penalties[exhaustion];
            subs[EFFECT_TOKEN]    = exhaustionPenalty > 0 ? (" + " + exhaustionPenalty) : exhaustionPenalty.ToString();
            ExhaustionValue.text  = AmbitionApp.Localize(STATUS_EFFECT_LOC, subs);
            FactionSymbol.sprite  = FactionSymbols.GetSprite(faction.ToString());
            ExhaustionIcon.sprite = exhaustion < 0
                ? ExhaustionIcons[0]
                : exhaustion < ExhaustionIcons.Length
                ? ExhaustionIcons[exhaustion]
                : ExhaustionIcons[ExhaustionIcons.Length];
            ExhaustionValue.color = exhaustion < 0 ? RestedBonusColor : ExhaustionPenaltyColor;
        }
Example #2
0
    public void Initialize(ActorDto actorDto)
    {
        Guid            = Guid.Parse(actorDto.Guid);
        gameObject.name = Guid.ToString();
        gameObject.tag  = FactionType.ToString();

        FactionType = actorDto.FactionType;
        Playable    = actorDto.Playable;

        TaskScheduler.Initialize(Guid);
        StatusEffectScheduler.Initialize(Guid);
        Attributes.Initialize(this, actorDto.AttributesDto);
        Status.Initialize(actorDto.StatusDto);

        Inventory.Initialize(actorDto.InventoryDto);
        Armory.Initialize(this, actorDto.ArmoryDto);
        Skills.Initialize(actorDto.SkillsDto);

        SkinnedMeshRenderer skinnedMeshRenderer = GetComponentInChildren <SkinnedMeshRenderer>();

        Face.Initialize(skinnedMeshRenderer, actorDto.FeaturesDto);
        Body.Initialize(skinnedMeshRenderer, actorDto.FeaturesDto);

        if (Playable)
        {
            Squad.AddToSquad(this);
        }
    }
Example #3
0
        public float AnticipationVal(float?inputVal)
        {
            if (inputVal == null)
            {
                inputVal = InputVal;
            }
            inputVal = inputVal - InputValStart;
            var faction = inputVal.Value / Step * Faction;

            if (FactionType == AttrFactionType.PercentAdd)
            {
                return(Val * (1 + faction));
            }
            else if (FactionType == AttrFactionType.DirectAdd)
            {
                return(Val + (faction));
            }
            else if (FactionType == AttrFactionType.DirectMul)
            {
                return(Val * faction);
            }
            else if (FactionType == AttrFactionType.None)
            {
                return(Val);
            }
            else
            {
                throw new Exception("错误的FactionType:" + FactionType.ToString());
            }
        }
Example #4
0
 public override string ToString()
 {
     return("Faction: " + Type.ToString() +
            "\n modesty: " + Modesty.ToString() +
            "\n luxury: " + Luxury.ToString() +
            "\n steadfast: " + Steadfast.ToString() +
            "\n allegiance: " + Allegiance.ToString() +
            "\n power: " + Power.ToString());
 }
Example #5
0
 public FactionFlipConfirmationScreen(FactionType currentFaction, FactionType oppositeFaction, OnScreenModalResult onModalResult) : base(false, null, null, null, false)
 {
     base.OnModalResult = onModalResult;
     this.title         = this.lang.Get("FACTION_FLIP_CONFIRMATION_TITLE", new object[0]);
     this.message       = this.lang.Get("FACTION_FLIP_CONFIRMATION_DESCRIPTION", new object[]
     {
         this.lang.Get(oppositeFaction.ToString().ToLower(), new object[0]),
         this.lang.Get(currentFaction.ToString().ToLower(), new object[0])
     });
 }
Example #6
0
 public FactionLibraryItem GetItemByFactionType(FactionType factionType)
 {
     for (int i = 0; i < factionLibraryItems.Length; i++)
     {
         if (factionLibraryItems[i].FactionType == factionType)
         {
             return(factionLibraryItems[i]);
         }
     }
     Debug.LogError("No FactionLibraryItem for factionType: " + factionType.ToString());
     return(null);
 }
        private void PopulatePlayerInfo(AccountSyncAccountType type, string playerName, int hqLevel, int medals, FactionType faction, string squadName)
        {
            UXLabel uXLabel;
            UXLabel uXLabel2;
            UXLabel uXLabel3;
            UXLabel uXLabel4;
            UXLabel uXLabel5;

            this.UpdateAndGetLabels(type, out uXLabel, out uXLabel2, out uXLabel3, out uXLabel4, out uXLabel5);
            uXLabel.Visible  = true;
            uXLabel2.Visible = true;
            uXLabel3.Visible = true;
            uXLabel4.Visible = true;
            uXLabel5.Visible = true;
            uXLabel.Text     = this.lang.Get("ACCOUNT_CONFLICT_CALL_SIGN", new object[]
            {
                playerName
            });
            uXLabel2.Text = this.lang.Get("ACCOUNT_CONFLICT_HQ_LEVEL", new object[]
            {
                hqLevel
            });
            uXLabel3.Text = this.lang.Get("ACCOUNT_CONFLICT_PLAYER_RATING", new object[]
            {
                medals
            });
            uXLabel4.Text = this.lang.Get("ACCOUNT_CONFLICT_FACTION", new object[]
            {
                StringUtils.ParseEnum <FactionType>(faction.ToString())
            });
            if (string.IsNullOrEmpty(squadName))
            {
                squadName = this.lang.Get("general_none", new object[0]);
            }
            uXLabel5.Text = this.lang.Get("ACCOUNT_CONFLICT_GUILD_NAME", new object[]
            {
                squadName
            });
        }
Example #8
0
 /// <summary>
 /// Displays the inactive player locally.
 /// </summary>
 private void DisplayInactivePlayer()
 {
     ToggleActivePlayerDisplay(false);
     _nameText.text = _factionTypeDisplaying.ToString();
 }
Example #9
0
 public SetFactionRequest(FactionType faction)
 {
     this.factionString = faction.ToString().ToLower();
     base.PlayerId      = Service.CurrentPlayer.PlayerId;
 }
Example #10
0
        private void AddBattleLogItem(BattleEntry entry)
        {
            CurrentPlayer     currentPlayer = Service.CurrentPlayer;
            bool              flag          = currentPlayer.PlayerId == entry.AttackerID;
            BattleParticipant battleParticipant;
            BattleParticipant battleParticipant2;

            if (flag)
            {
                battleParticipant  = entry.Attacker;
                battleParticipant2 = entry.Defender;
            }
            else
            {
                battleParticipant  = entry.Defender;
                battleParticipant2 = entry.Attacker;
            }
            string      playerName  = battleParticipant2.PlayerName;
            string      guildName   = battleParticipant2.GuildName;
            FactionType factionType = battleParticipant2.PlayerFaction;

            if (factionType == FactionType.Invalid)
            {
                factionType = GameUtils.GetOppositeFaction(currentPlayer.Faction);
            }
            int       num   = GameUtils.CalcuateMedals(battleParticipant.AttackRating, battleParticipant.DefenseRating);
            int       num2  = GameUtils.CalcuateMedals(battleParticipant.AttackRating + battleParticipant.AttackRatingDelta, battleParticipant.DefenseRating + battleParticipant.DefenseRatingDelta);
            int       value = num2 - num;
            int       tournamentRatingDelta = battleParticipant.TournamentRatingDelta;
            bool      flag2          = GameUtils.IsBattleVersionSupported(entry.CmsVersion, entry.BattleVersion);
            bool      flag3          = Service.SquadController.StateManager.GetCurrentSquad() != null;
            bool      visible        = flag2;
            bool      visible2       = !flag && entry.IsPvP() && !entry.Revenged && entry.PlanetId == currentPlayer.PlanetId;
            bool      visible3       = flag2 && flag3;
            uint      time           = ServerTime.Time;
            int       totalSeconds   = (int)(time - entry.EndBattleServerTime);
            int       count          = this.itemGrid.Count;
            string    text           = string.Format("{0}{1}", "BattleLogItem", count);
            UXElement item           = this.itemGrid.CloneTemplateItem(text);
            bool      won            = entry.Won;
            Color     winResultColor = UXUtils.GetWinResultColor(won);
            UXButton  subElement     = this.itemGrid.GetSubElement <UXButton>(text, "BtnReplay");

            subElement.Tag       = entry;
            subElement.OnClicked = new UXButtonClickedDelegate(this.OnReplayButtonClicked);
            subElement.Visible   = visible;
            UXButton subElement2 = this.itemGrid.GetSubElement <UXButton>(text, "BtnRevenge");

            subElement2.Tag       = entry;
            subElement2.OnClicked = new UXButtonClickedDelegate(this.OnRevengeButtonClicked);
            subElement2.Visible   = visible2;
            if (this.revengeButtons == null)
            {
                this.revengeButtons = new List <UXButton>();
            }
            this.revengeButtons.Add(subElement2);
            UXButton subElement3 = this.itemGrid.GetSubElement <UXButton>(text, "BtnShare");

            subElement3.Tag       = entry;
            subElement3.OnClicked = new UXButtonClickedDelegate(this.OnShareButtonClicked);
            subElement3.Visible   = visible3;
            UXLabel subElement4 = this.itemGrid.GetSubElement <UXLabel>(text, "LabelBtnShare");

            subElement4.Text = this.lang.Get("s_Share", new object[0]);
            UXLabel subElement5 = this.itemGrid.GetSubElement <UXLabel>(text, "LabelBtnReplay");

            subElement5.Text = this.lang.Get("BUTTON_REPLAY", new object[0]);
            UXLabel subElement6 = this.itemGrid.GetSubElement <UXLabel>(text, "LabelBtnRevenge");

            subElement6.Text = this.lang.Get("s_Revenge", new object[0]);
            bool    flag4       = this.curTab == BattleLogTab.Attack;
            int     value2      = (!flag4) ? entry.LootCreditsDeducted : entry.LootCreditsEarned;
            int     value3      = (!flag4) ? entry.LootMaterialsDeducted : entry.LootMaterialsEarned;
            int     value4      = (!flag4) ? entry.LootContrabandDeducted : entry.LootContrabandEarned;
            UXLabel subElement7 = this.itemGrid.GetSubElement <UXLabel>(text, "LabelCredits");

            subElement7.Text = this.lang.ThousandsSeparated(value2);
            UXLabel subElement8 = this.itemGrid.GetSubElement <UXLabel>(text, "LabelMaterials");

            subElement8.Text = this.lang.ThousandsSeparated(value3);
            UXElement subElement9 = this.itemGrid.GetSubElement <UXElement>(text, "Contraband");

            if (currentPlayer.IsContrabandUnlocked)
            {
                subElement9.Visible = true;
                UXLabel subElement10 = this.itemGrid.GetSubElement <UXLabel>(text, "LabelContraband");
                subElement10.Text = this.lang.ThousandsSeparated(value4);
            }
            else
            {
                subElement9.Visible = false;
            }
            UXLabel subElement11 = this.itemGrid.GetSubElement <UXLabel>(text, "LabelBasePoints");

            subElement11.Text      = this.lang.ThousandsSeparated(value);
            subElement11.TextColor = winResultColor;
            UXLabel subElement12 = this.itemGrid.GetSubElement <UXLabel>(text, "LabelDamage");

            subElement12.Text = this.lang.Get("DAMAGE_PERCENT", new object[]
            {
                entry.DamagePercent
            });
            UXLabel subElement13 = this.itemGrid.GetSubElement <UXLabel>(text, "LabelResult");

            subElement13.Text      = this.lang.Get((!won) ? "YOU_LOST" : "YOU_WON", new object[0]);
            subElement13.TextColor = winResultColor;
            UXLabel subElement14 = this.itemGrid.GetSubElement <UXLabel>(text, "LabelTimeStamp");

            subElement14.Text = this.lang.Get("TIME_AGO", new object[]
            {
                GameUtils.GetTimeLabelFromSeconds(totalSeconds)
            });
            UXLabel subElement15 = this.itemGrid.GetSubElement <UXLabel>(text, "LabelPlayerName");

            subElement15.Text = playerName;
            UXLabel subElement16 = this.itemGrid.GetSubElement <UXLabel>(text, "LabelFactionName");

            subElement16.Text = guildName;
            UXSprite subElement17 = this.itemGrid.GetSubElement <UXSprite>(text, "SpriteFaction");

            subElement17.SpriteName = "Faction" + factionType.ToString();
            if (!string.IsNullOrEmpty(entry.PlanetId))
            {
                PlanetVO  planetVO     = this.sdc.Get <PlanetVO>(entry.PlanetId);
                UXTexture subElement18 = this.itemGrid.GetSubElement <UXTexture>(text, "TexturePlanetBg");
                subElement18.LoadTexture(planetVO.LeaderboardTileTexture);
            }
            UXGrid    subElement19 = this.itemGrid.GetSubElement <UXGrid>(text, "TroopsExpendedGrid");
            UXElement subElement20 = this.itemGrid.GetSubElement <UXElement>(text, "TroopsExpendedTemplate");

            subElement19.SetTemplateItem(subElement20.Root.name);
            this.AddExpendedItems(entry, text, subElement19);
            subElement19.RepositionItems();
            bool      flag5        = tournamentRatingDelta != 0;
            UXElement subElement21 = this.itemGrid.GetSubElement <UXElement>(text, "TournamentRating");

            subElement21.Visible = flag5;
            if (!string.IsNullOrEmpty(entry.PlanetId))
            {
                string tournamentPointIconName = GameUtils.GetTournamentPointIconName(entry.PlanetId);
                if (flag5 && !string.IsNullOrEmpty(tournamentPointIconName))
                {
                    UXSprite subElement22 = this.itemGrid.GetSubElement <UXSprite>(text, "SpriteTournamentRating");
                    subElement22.SpriteName = tournamentPointIconName;
                    UXLabel subElement23 = this.itemGrid.GetSubElement <UXLabel>(text, "LabelTournamentRating");
                    subElement23.Text      = tournamentRatingDelta.ToString();
                    subElement23.TextColor = winResultColor;
                }
            }
            this.itemGrid.AddItem(item, count);
        }
Example #11
0
        public static string GetFactionName(FactionType faction)
        {
            Lang lang = Service.Get <Lang>();

            return(lang.Get("FACTION_NAME_" + faction.ToString().ToUpper(), new object[0]));
        }
Example #12
0
        protected override void OnScreenLoaded()
        {
            base.GetElement <UXLabel>("LabelTitle").Text   = this.lang.Get("s_WhatsNextTitle", new object[0]);
            base.GetElement <UXLabel>("LabelBtnNext").Text = this.lang.Get("SPEC_OPS_CONTINUE", new object[0]);
            UXButton element = base.GetElement <UXButton>("BtnNext");

            element.OnClicked        = new UXButtonClickedDelegate(this.Close);
            base.CurrentBackDelegate = element.OnClicked;
            base.CurrentBackButton   = element;
            base.AllowFUEBackButton  = true;
            FactionType faction  = Service.CurrentPlayer.Faction;
            UXLabel     element2 = base.GetElement <UXLabel>("LabelWhatNext");

            element2.Text = LangUtils.ProcessStringWithNewlines(this.lang.Get("s_WhatsNextDescription_" + faction.ToString(), new object[0]));
            string assetName;

            if (faction != FactionType.Empire)
            {
                assetName = "WhatsNextRebel";
            }
            else
            {
                assetName = "WhatsNextEmpire";
            }
            base.GetElement <UXTexture>("SpriteNextImage").LoadTexture(assetName);
        }