コード例 #1
0
ファイル: WorldData.cs プロジェクト: yakoder/NRaas
        private static bool GetWorldFileDetails(ref WorldFileMetadata info)
        {
            string mWorldFile = info.mWorldFile;

            if (!mWorldFile.ToLower().EndsWith(".world"))
            {
                mWorldFile = mWorldFile + ".world";
            }

            info.mDescription = null;
            info.mWorldThumb  = null;
            info.mLotCount    = 0x0;

            WorldName worldName    = WorldName.Undefined;
            ulong     worldNameKey = 0x0L;

            string entryKey = UIManager.GetWorldMetadata(mWorldFile, ref info.mLotCount, ref info.mWorldThumb, ref worldNameKey, ref info.mWorldType, ref worldName);

            if (!GameUtils.WorldNameToType.ContainsKey(worldName))
            {
                GameUtils.WorldNameToType.Add(worldName, info.mWorldType);
            }

            ILocalizationModel localizationModel = Sims3.Gameplay.UI.Responder.Instance.LocalizationModel;

            if (entryKey != null)
            {
                if (localizationModel.HasLocalizationString(entryKey))
                {
                    info.mDescription = localizationModel.LocalizeString(entryKey, new object[0x0]);
                }
                else
                {
                    info.mDescription = entryKey;
                }
            }

            if ((worldNameKey != 0x0L) && localizationModel.HasLocalizationString(worldNameKey))
            {
                info.mCaption = localizationModel.LocalizeString(worldNameKey);
            }

            if (string.IsNullOrEmpty(info.mCaption))
            {
                BooterLogger.AddTrace("Untranslated " + mWorldFile + ": " + worldNameKey);

                if (mWorldFile.ToLower().EndsWith(".world"))
                {
                    int num2 = mWorldFile.LastIndexOfAny(new char[] { '\\', '/' });
                    info.mCaption = ((num2 >= 0x0) && (mWorldFile.Length > 0x0)) ? mWorldFile.Substring(num2 + 0x1) : mWorldFile.Substring(0x0, mWorldFile.Length - 0x6);
                }
                else
                {
                    info.mCaption = mWorldFile;
                }
            }

            if (info.mDescription == null)
            {
                info.mDescription = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Fusce pulvinar. Donec faucibus, dolor eu porta lobortis ante nibh vulputate justo, velvolutpat odio sapien venenatis justo. Quisque sit amet felis acelit imperdiet hendrerit. Nam ut mauris et nisi varius portitor. Fusce blandit, diam id varius portitor, sem elit bibendum dolor, congue molestie sapien lorem vel dolor. Fusce laoreet est non urna euismod commodo. Donec enim quam, blandit at, placerat in, eleifend vitae, justo. Suspendisse potenti. In blandit pede sit amet sem. Nam condimentum sapien sit amet erat.";
            }

            if (info.mWorldThumb == null)
            {
                info.mWorldThumb = UIManager.LoadUIImage(ResourceKey.CreatePNGKey("game_entry_town_placeholder", 0x0));
            }
            return(true);
        }
コード例 #2
0
ファイル: EditTownControllerEx.cs プロジェクト: yakoder/NRaas
        public static void ChangeLotTypeTask(object obj)
        {
            try
            {
                EditTownController ths = EditTownController.Instance;

                UIBinInfo info = obj as UIBinInfo;
                if ((info != null) && (info.LotId != ulong.MaxValue))
                {
                    ths.mModel.SetCurrentSelection(null, InfoSource.Unknown);
                    ILocalizationModel    localizationModel     = Sims3.UI.Responder.Instance.LocalizationModel;
                    LotType               lotType               = info.LotType;
                    CommercialLotSubType  commercialLotSubType  = info.CommercialLotSubType;
                    ResidentialLotSubType residentialLotSubType = info.ResidentialLotSubType;
                    string lotTypeName = "";

                    if (ChangeLotTypeDialogEx.Show(ref lotType, ref commercialLotSubType, ref residentialLotSubType, ref lotTypeName, info.IsHouseboatLot))
                    {
                        if (((lotType == LotType.Commercial) && (commercialLotSubType == CommercialLotSubType.kEP1_BaseCamp)) && ths.mModel.IsAnyLotBaseCamp())
                        {
                            string titleText   = Common.LocalizeEAString("Ui/Caption/Global:Failed");
                            string messageText = Common.LocalizeEAString("Ui/Caption/GameEntry/EditTown/EP01:BaseCampExists");
                            SimpleMessageDialog.Show(titleText, messageText, ModalDialog.PauseMode.PauseSimulator, new Vector2(-1f, -1f), "ui_error", "ui_hardwindow_close");
                        }
                        else if (((lotType == LotType.Commercial) && (commercialLotSubType == CommercialLotSubType.kEP11_BaseCampFuture)) && ths.mModel.IsAnyLotBaseCamp())
                        {
                            string str4 = localizationModel.LocalizeString("Ui/Caption/Global:Failed", new object[0]);
                            string str5 = localizationModel.LocalizeString("Ui/Caption/GameEntry/EditTown/EP11:BaseCampFutureExists", new object[0]);
                            SimpleMessageDialog.Show(str4, str5, ModalDialog.PauseMode.PauseSimulator, new Vector2(-1f, -1f), "ui_error", "ui_hardwindow_close");
                        }
                        else if (EditTownModelEx.ChangeLotType(info.LotId, false, lotType, commercialLotSubType, residentialLotSubType))
                        {
                            EditTownController.AlertLotTypeChangeSuccess(info, localizationModel, lotType, lotTypeName);
                        }
                        else
                        {
                            string promptText = string.Empty;
                            if (commercialLotSubType == CommercialLotSubType.kEP10_Resort)
                            {
                                promptText = localizationModel.LocalizeString("Ui/Caption/GameEntry/EditTown:LotTypeResortFailed", new object[] { info.LotAddress });
                            }
                            else
                            {
                                promptText = localizationModel.LocalizeString((lotType == LotType.Commercial) ? "Ui/Caption/GameEntry/EditTown:LotTypeCommunityFailed" : "Ui/Caption/GameEntry/EditTown:LotTypeResidentialFailed", new object[] { info.LotAddress });
                            }

                            if (AcceptCancelDialog.Show(promptText))
                            {
                                if (EditTownModelEx.ChangeLotType(info.LotId, true, lotType, commercialLotSubType, residentialLotSubType))
                                {
                                    EditTownController.AlertLotTypeChangeSuccess(info, localizationModel, lotType, lotTypeName);
                                    EditTownMaptagController.Instance.ResetMaptags();
                                }
                                else
                                {
                                    string str5 = Common.LocalizeEAString("Ui/Caption/Global:Failed");
                                    promptText = Common.LocalizeEAString("Ui/Caption/GameEntry/EditTown:LotTypeChangeFailed");
                                    SimpleMessageDialog.Show(str5, promptText, ModalDialog.PauseMode.PauseSimulator, new Vector2(-1f, -1f), "ui_error", "ui_hardwindow_close");
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Common.Exception("ChangeLotTypeTask", e);
            }
        }