示例#1
0
        private static void OnLangFailure(object cookie)
        {
            Lang   lang = Service.Lang;
            string text = "en_US";

            if (lang.Locale != text)
            {
                lang.Locale = text;
                Service.ServerPlayerPrefs.SetPref(ServerPref.Locale, text);
                LangUtils.AddLocalStringsData(text);
                lang.UnloadAssets();
                LangUtils.LoadStringData((AssetsCompleteDelegate)cookie);
            }
            else
            {
                LangUtils.OnLangComplete(null, cookie);
            }
        }
示例#2
0
        public static bool TrySetupConflictEndedRewardView(List <string> rewardUids, UXLabel label, UXSprite sprite)
        {
            if (rewardUids == null || rewardUids.Count == 0)
            {
                return(false);
            }
            CrateVO optional = Service.Get <IDataController>().GetOptional <CrateVO>(rewardUids[0]);

            if (optional == null)
            {
                return(false);
            }
            string uid = optional.Uid;

            label.Text = LangUtils.GetCrateDisplayName(uid);
            RewardUtils.SetCrateIcon(sprite, optional, AnimState.Closed);
            return(true);
        }
示例#3
0
        public static void CreateLangService()
        {
            new EnvironmentController();
            string locale = PlayerSettings.GetLocaleCopy();
            string json;

            if (!LangUtils.TryLoadLocalStringsFile(locale, out json))
            {
                locale = Service.Get <EnvironmentController>().GetLocale();
                if (!LangUtils.TryLoadLocalStringsFile(locale, out json))
                {
                    locale = "en_US";
                    LangUtils.TryLoadLocalStringsFile(locale, out json);
                }
            }
            Lang lang = new Lang(locale);

            lang.AddStringData(json);
        }
示例#4
0
 public unsafe static long $Invoke33(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(LangUtils.GetMissionTitle((CampaignMissionVO)GCHandledObjects.GCHandleToObject(*args))));
 }
示例#5
0
 public unsafe static long $Invoke28(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(LangUtils.GetMissionButtonDisplayText((MissionType)(*(int *)args))));
 }
示例#6
0
 public unsafe static long $Invoke26(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(LangUtils.GetLEIDisplayName(Marshal.PtrToStringUni(*(IntPtr *)args))));
 }
示例#7
0
 public unsafe static long $Invoke24(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(LangUtils.GetHolonetBattleTransmissionDescText((TransmissionVO)GCHandledObjects.GCHandleToObject(*args))));
 }
示例#8
0
 public unsafe static long $Invoke21(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(LangUtils.GetFactionName((FactionType)(*(int *)args))));
 }
示例#9
0
 public unsafe static long $Invoke6(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(LangUtils.GetBuildingDescription((BuildingTypeVO)GCHandledObjects.GCHandleToObject(*args))));
 }
示例#10
0
 public unsafe static long $Invoke5(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(LangUtils.GetBattleOnPlanetName((BattleTypeVO)GCHandledObjects.GCHandleToObject(*args))));
 }
示例#11
0
 public unsafe static long $Invoke3(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(LangUtils.FormatTime(*args)));
 }
示例#12
0
 public unsafe static long $Invoke2(long instance, long *args)
 {
     LangUtils.CreateLangService();
     return(-1L);
 }
示例#13
0
 public unsafe static long $Invoke1(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(LangUtils.AppendPlayerFactionToKey(Marshal.PtrToStringUni(*(IntPtr *)args))));
 }
示例#14
0
 public unsafe static long $Invoke0(long instance, long *args)
 {
     LangUtils.AddLocalStringsData(Marshal.PtrToStringUni(*(IntPtr *)args));
     return(-1L);
 }
示例#15
0
 public static string GetShardLockedEquipmentString(EquipmentVO equipmentVO)
 {
     return(LangUtils.GetShardLockedItemString(equipmentVO.EquipmentID, equipmentVO.UpgradeShards));
 }
示例#16
0
 public unsafe static long $Invoke18(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(LangUtils.GetEquipmentDescription((EquipmentVO)GCHandledObjects.GCHandleToObject(*args))));
 }
示例#17
0
 public unsafe static long $Invoke19(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(LangUtils.GetEquipmentDisplayName((EquipmentVO)GCHandledObjects.GCHandleToObject(*args))));
 }
示例#18
0
 public unsafe static long $Invoke8(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(LangUtils.GetBuildingVerb((BuildingType)(*(int *)args))));
 }
示例#19
0
 public unsafe static long $Invoke23(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(LangUtils.GetHeroAbilityDisplayName((TroopAbilityVO)GCHandledObjects.GCHandleToObject(*args))));
 }
示例#20
0
 public unsafe static long $Invoke9(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(LangUtils.GetCampaignDescription((CampaignVO)GCHandledObjects.GCHandleToObject(*args))));
 }
示例#21
0
 public unsafe static long $Invoke25(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(LangUtils.GetHolonetTransmissionCharacterName((TransmissionVO)GCHandledObjects.GCHandleToObject(*args))));
 }
示例#22
0
 public unsafe static long $Invoke11(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(LangUtils.GetClearableDisplayName((BuildingTypeVO)GCHandledObjects.GCHandleToObject(*args))));
 }
示例#23
0
 public unsafe static long $Invoke27(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(LangUtils.GetLevelText(*(int *)args)));
 }
示例#24
0
 public unsafe static long $Invoke12(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(LangUtils.GetContextButtonText(Marshal.PtrToStringUni(*(IntPtr *)args))));
 }
示例#25
0
 public unsafe static long $Invoke30(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(LangUtils.GetMissionDifficultyLabel(Marshal.PtrToStringUni(*(IntPtr *)args))));
 }
示例#26
0
 public unsafe static long $Invoke13(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(LangUtils.GetCrateDisplayName((CrateVO)GCHandledObjects.GCHandleToObject(*args))));
 }
示例#27
0
 public unsafe static long $Invoke34(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(LangUtils.GetMultiplierText(*(int *)args)));
 }
示例#28
0
 public unsafe static long $Invoke15(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(LangUtils.GetCurrencyStringId((CurrencyType)(*(int *)args))));
 }
示例#29
0
        public static int TransferPrizeFromInventory(PrizeType prizeType, string prizeID)
        {
            Lang             lang               = Service.Get <Lang>();
            IDataController  dataController     = Service.Get <IDataController>();
            CurrentPlayer    currentPlayer      = Service.Get <CurrentPlayer>();
            PrizeInventory   prizes             = currentPlayer.Prizes;
            Inventory        inventory          = currentPlayer.Inventory;
            InventoryStorage inventoryStorage   = null;
            IUpgradeableVO   finalUnitFromPrize = TimedEventPrizeUtils.GetFinalUnitFromPrize(prizeType, prizeID);
            string           text               = null;
            string           text2              = null;
            string           id = null;
            int result          = 0;
            int num             = 0;

            switch (prizeType)
            {
            case PrizeType.Currency:
                num = prizes.GetResourceAmount(prizeID);
                TimedEventPrizeUtils.GetCurrencyAmountToTransfer(prizeID, ref num, ref result);
                if (num > 0)
                {
                    inventory.ModifyItemAmount(prizeID, num);
                    prizes.ModifyResourceAmount(prizeID, -num);
                    text  = "INVENTORY_REWARD_USED_CURRENCY";
                    text2 = lang.Get(prizeID.ToUpper(), new object[0]);
                }
                else
                {
                    id = "INVENTORY_NO_ROOM";
                }
                break;

            case PrizeType.Infantry:
            case PrizeType.Vehicle:
            case PrizeType.Mercenary:
                inventoryStorage = inventory.Troop;
                if (inventoryStorage.GetTotalStorageCapacity() >= inventoryStorage.GetTotalStorageAmount() + finalUnitFromPrize.Size)
                {
                    num = 1;
                    inventoryStorage.ModifyItemAmount(finalUnitFromPrize.Uid, num);
                    prizes.ModifyTroopAmount(prizeID, -num);
                    text  = "INVENTORY_REWARD_USED_TROOP";
                    text2 = LangUtils.GetTroopDisplayName((TroopTypeVO)finalUnitFromPrize);
                    StorageSpreadUtils.UpdateAllStarportFullnessMeters();
                }
                else
                {
                    id = "NOT_ENOUGH_HOUSING";
                }
                result = prizes.GetTroopAmount(prizeID);
                break;

            case PrizeType.Hero:
                inventoryStorage = inventory.Hero;
                if (!Service.Get <BuildingLookupController>().HasHeroCommand())
                {
                    id = "INVENTORY_NO_HERO_COMMAND";
                }
                else if (inventoryStorage.GetTotalStorageCapacity() >= inventoryStorage.GetTotalStorageAmount() + finalUnitFromPrize.Size)
                {
                    bool flag = false;
                    foreach (KeyValuePair <string, InventoryEntry> current in inventoryStorage.GetInternalStorage())
                    {
                        if (current.get_Value().Amount > 0)
                        {
                            TroopTypeVO troopTypeVO = dataController.Get <TroopTypeVO>(current.get_Key());
                            if (troopTypeVO.UpgradeGroup == finalUnitFromPrize.UpgradeGroup)
                            {
                                flag = true;
                                break;
                            }
                        }
                    }
                    if (!flag)
                    {
                        flag = ContractUtils.HasExistingHeroContract(finalUnitFromPrize.UpgradeGroup);
                    }
                    if (!flag)
                    {
                        num = 1;
                        inventoryStorage.ModifyItemAmount(finalUnitFromPrize.Uid, num);
                        prizes.ModifyTroopAmount(prizeID, -num);
                        text  = "INVENTORY_REWARD_USED_HERO";
                        text2 = LangUtils.GetTroopDisplayName((TroopTypeVO)finalUnitFromPrize);
                        Service.Get <EventManager>().SendEvent(EventId.HeroMobilizedFromPrize, finalUnitFromPrize.Uid);
                    }
                    else
                    {
                        id = "INVENTORY_NO_ROOM_HERO_IN_QUEUE";
                    }
                }
                else
                {
                    id = "INVENTORY_NO_ROOM_HERO";
                }
                result = prizes.GetTroopAmount(prizeID);
                break;

            case PrizeType.SpecialAttack:
                inventoryStorage = inventory.SpecialAttack;
                if (!Service.Get <BuildingLookupController>().HasStarshipCommand())
                {
                    id = "INVENTORY_NO_FLEET_COMMAND";
                }
                else if (inventoryStorage.GetTotalStorageCapacity() >= inventoryStorage.GetTotalStorageAmount() + finalUnitFromPrize.Size)
                {
                    num = 1;
                    inventoryStorage.ModifyItemAmount(finalUnitFromPrize.Uid, num);
                    prizes.ModifySpecialAttackAmount(prizeID, -num);
                    text  = "INVENTORY_REWARD_USED_TROOP";
                    text2 = LangUtils.GetStarshipDisplayName((SpecialAttackTypeVO)finalUnitFromPrize);
                    Service.Get <EventManager>().SendEvent(EventId.StarshipMobilizedFromPrize, finalUnitFromPrize.Uid);
                }
                else
                {
                    id = "NOT_ENOUGH_SPACE";
                }
                result = prizes.GetSpecialAttackAmount(prizeID);
                break;
            }
            if (num > 0)
            {
                InventoryTransferRequest request = new InventoryTransferRequest(prizeID, num);
                Service.Get <ServerAPI>().Enqueue(new InventoryTransferCommand(request));
            }
            else
            {
                string message = lang.Get(id, new object[0]);
                AlertScreen.ShowModal(false, null, message, null, null);
            }
            if (text != null)
            {
                string text3 = (prizeType == PrizeType.Hero) ? text2 : lang.Get("AMOUNT_AND_NAME", new object[]
                {
                    num,
                    text2
                });
                string instructions = lang.Get(text, new object[]
                {
                    text3
                });
                Service.Get <UXController>().MiscElementsManager.ShowPlayerInstructions(instructions, 1f, 2f);
            }
            return(result);
        }
示例#30
0
 public unsafe static long $Invoke16(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(LangUtils.GetDeltaString(*(int *)args)));
 }