protected virtual void ServiceButton_OnMouseClick(BaseScreenComponent sender, Vector2 position)
        {
            DaggerfallUI.Instance.PlayOneShot(SoundClips.ButtonClick);
            CloseWindow();

            // Use a registered custom service method
            Guilds.Services.CustomMerchantService customMerchantService;
            if (Guilds.Services.GetCustomMerchantService(merchantNPC.Data.factionID, out customMerchantService))
            {
                customMerchantService(this);
            }
            else
            {
                switch (currentService)
                {
                default:
                case Services.Sell:
                    uiManager.PushWindow(UIWindowFactory.GetInstanceWithArgs(UIWindowType.Trade, new object[] { uiManager, this, DaggerfallTradeWindow.WindowModes.Sell, null }));
                    break;

                case Services.Banking:
                    uiManager.PushWindow(UIWindowFactory.GetInstance(UIWindowType.Banking, uiManager, this));
                    break;
                }
            }
        }
Пример #2
0
        void StartNewGame()
        {
            // Assign character document to player entity
            startGameBehaviour.CharacterDocument = characterDocument;

            if (DaggerfallUI.Instance.enableVideos)
            {
                // Create cinematics
                DaggerfallVidPlayerWindow cinematic1 = (DaggerfallVidPlayerWindow)UIWindowFactory.GetInstanceWithArgs(UIWindowType.VidPlayer, new object[] { uiManager, newGameCinematic1 });
                DaggerfallVidPlayerWindow cinematic2 = (DaggerfallVidPlayerWindow)UIWindowFactory.GetInstanceWithArgs(UIWindowType.VidPlayer, new object[] { uiManager, newGameCinematic2 });
                DaggerfallVidPlayerWindow cinematic3 = (DaggerfallVidPlayerWindow)UIWindowFactory.GetInstanceWithArgs(UIWindowType.VidPlayer, new object[] { uiManager, newGameCinematic3 });

                // End of final cinematic will launch game
                cinematic3.OnVideoFinished += TriggerGame;

                // Push cinematics in reverse order so they play and pop out in correct order
                uiManager.PushWindow(cinematic3);
                uiManager.PushWindow(cinematic2);
                uiManager.PushWindow(cinematic1);
            }
            else
            {
                TriggerGame();
            }
        }
Пример #3
0
        protected override void Setup()
        {
            // Load all the textures used by spell maker window
            LoadTextures();

            // Always dim background
            ParentPanel.BackgroundColor = ScreenDimColor;

            // Setup native panel background
            NativePanel.BackgroundColor   = new Color(0, 0, 0, 0.75f);
            NativePanel.BackgroundTexture = baseTexture;

            // Setup controls
            SetupLabels();
            SetupButtons();
            SetupPickers();
            SetIcon(selectedIcon);
            SetStatusLabels();

            // Setup effect editor window
            effectEditor = (DaggerfallEffectSettingsEditorWindow)UIWindowFactory.GetInstanceWithArgs(UIWindowType.EffectSettingsEditor, new object[] { uiManager, this });
            effectEditor.OnSettingsChanged += EffectEditor_OnSettingsChanged;
            effectEditor.OnClose           += EffectEditor_OnClose;

            // Setup icon picker
            iconPicker          = (SpellIconPickerWindow)UIWindowFactory.GetInstance(UIWindowType.SpellIconPicker, uiManager, this);
            iconPicker.OnClose += IconPicker_OnClose;
        }
 private void SaveButton_OnMouseClick(BaseScreenComponent sender, Vector2 position)
 {
     DaggerfallUI.Instance.PlayOneShot(SoundClips.ButtonClick);
     if (GameManager.Instance.SaveLoadManager.IsSavingPrevented)
     {
         DaggerfallUI.MessageBox(TextManager.Instance.GetLocalizedText("cannotSaveNow"));
     }
     else
     {
         uiManager.PushWindow(UIWindowFactory.GetInstanceWithArgs(UIWindowType.UnitySaveGame, new object[] { uiManager, DaggerfallUnitySaveGameWindow.Modes.SaveGame, this, false }));
     }
 }
 void SellButton_OnKeyboardEvent(BaseScreenComponent sender, Event keyboardEvent)
 {
     if (keyboardEvent.type == EventType.KeyDown)
     {
         DaggerfallUI.Instance.PlayOneShot(SoundClips.ButtonClick);
         isSellWindowDeferred = true;
     }
     else if (keyboardEvent.type == EventType.KeyUp && isSellWindowDeferred)
     {
         isSellWindowDeferred = false;
         CloseWindow();
         uiManager.PushWindow(UIWindowFactory.GetInstanceWithArgs(UIWindowType.Trade, new object[] { uiManager, this, DaggerfallTradeWindow.WindowModes.Sell, null }));
     }
 }
Пример #6
0
 private void LoadButton_OnMouseClick(BaseScreenComponent sender, Vector2 position)
 {
     DaggerfallUI.Instance.PlayOneShot(SoundClips.ButtonClick);
     uiManager.PushWindow(UIWindowFactory.GetInstanceWithArgs(UIWindowType.UnitySaveGame, new object[] { uiManager, DaggerfallUnitySaveGameWindow.Modes.LoadGame, this, false }));
 }
 void LoadGame()
 {
     uiManager.PushWindow(UIWindowFactory.GetInstanceWithArgs(UIWindowType.UnitySaveGame, new object[] { uiManager, DaggerfallUnitySaveGameWindow.Modes.LoadGame, null, true }));
 }
Пример #8
0
 private void SellButton_OnMouseClick(BaseScreenComponent sender, Vector2 position)
 {
     CloseWindow();
     uiManager.PushWindow(UIWindowFactory.GetInstanceWithArgs(UIWindowType.Trade, new object[] { uiManager, this, DaggerfallTradeWindow.WindowModes.Sell, null }));
 }
Пример #9
0
        private void ServiceButton_OnMouseClick(BaseScreenComponent sender, Vector2 position)
        {
            // Check access to service
            if (!guild.CanAccessService(service))
            {
                if (guild.IsMember())
                {
                    DaggerfallMessageBox msgBox = new DaggerfallMessageBox(uiManager, this);
                    msgBox.SetTextTokens(DaggerfallUnity.Instance.TextProvider.GetRandomTokens(InsufficientRankId));
                    msgBox.ClickAnywhereToClose = true;
                    msgBox.Show();
                }
                else
                {
                    DaggerfallUI.MessageBox(TextManager.Instance.GetText(textDatabase, "serviceMembersOnly"));
                }
                return;
            }
            // Handle known service
            DaggerfallTradeWindow tradeWindow;

            switch (service)
            {
            case GuildServices.Quests:
                DaggerfallUI.Instance.PlayOneShot(SoundClips.ButtonClick);
                GetQuest();
                break;

            case GuildServices.Identify:
                DaggerfallUI.Instance.PlayOneShot(SoundClips.ButtonClick);
                CloseWindow();
                uiManager.PushWindow(UIWindowFactory.GetInstanceWithArgs(UIWindowType.Trade, new object[] { uiManager, this, DaggerfallTradeWindow.WindowModes.Identify, guild }));
                break;

            case GuildServices.Repair:
                CloseWindow();
                uiManager.PushWindow(UIWindowFactory.GetInstanceWithArgs(UIWindowType.Trade, new object[] { uiManager, this, DaggerfallTradeWindow.WindowModes.Repair, guild }));
                break;

            case GuildServices.Training:
                DaggerfallUI.Instance.PlayOneShot(SoundClips.ButtonClick);
                TrainingService();
                break;

            case GuildServices.Donate:
                DaggerfallUI.Instance.PlayOneShot(SoundClips.ButtonClick);
                DonationService();
                break;

            case GuildServices.CureDisease:
                CureDiseaseService();
                break;

            case GuildServices.BuyPotions:
                DaggerfallUI.Instance.PlayOneShot(SoundClips.ButtonClick);
                CloseWindow();
                tradeWindow = (DaggerfallTradeWindow)UIWindowFactory.GetInstanceWithArgs(UIWindowType.Trade, new object[] { uiManager, this, DaggerfallTradeWindow.WindowModes.Buy, guild });
                tradeWindow.MerchantItems = GetMerchantPotions();
                uiManager.PushWindow(tradeWindow);
                break;

            case GuildServices.MakePotions:
                DaggerfallUI.Instance.PlayOneShot(SoundClips.ButtonClick);
                MakePotionService();
                break;

            case GuildServices.BuySpells:
            case GuildServices.BuySpellsMages:
                CloseWindow();
                uiManager.PushWindow(UIWindowFactory.GetInstanceWithArgs(UIWindowType.SpellBook, new object[] { uiManager, this, true }));
                break;

            case GuildServices.MakeSpells:
                DaggerfallUI.Instance.PlayOneShot(SoundClips.ButtonClick);
                CloseWindow();
                if (GameManager.Instance.PlayerEntity.Items.Contains(ItemGroups.MiscItems, (int)MiscItems.Spellbook))
                {
                    uiManager.PushWindow(DaggerfallUI.Instance.DfSpellMakerWindow);
                }
                else
                {
                    DaggerfallUI.MessageBox(TextManager.Instance.GetText("ClassicEffects", "noSpellbook"));
                }
                break;

            case GuildServices.BuyMagicItems:       // TODO: switch items depending on npcService?
                DaggerfallUI.Instance.PlayOneShot(SoundClips.ButtonClick);
                CloseWindow();
                tradeWindow = (DaggerfallTradeWindow)UIWindowFactory.GetInstanceWithArgs(UIWindowType.Trade, new object[] { uiManager, this, DaggerfallTradeWindow.WindowModes.Buy, guild });
                tradeWindow.MerchantItems = GetMerchantMagicItems();
                uiManager.PushWindow(tradeWindow);
                break;

            case GuildServices.MakeMagicItems:
                DaggerfallUI.Instance.PlayOneShot(SoundClips.ButtonClick);
                CloseWindow();
                uiManager.PushWindow(DaggerfallUI.Instance.DfItemMakerWindow);
                break;

            case GuildServices.SellMagicItems:
                CloseWindow();
                uiManager.PushWindow(UIWindowFactory.GetInstanceWithArgs(UIWindowType.Trade, new object[] { uiManager, this, DaggerfallTradeWindow.WindowModes.SellMagic, guild }));
                break;

            case GuildServices.Teleport:
                DaggerfallUI.Instance.PlayOneShot(SoundClips.ButtonClick);
                CloseWindow();
                DaggerfallUI.Instance.DfTravelMapWindow.ActivateTeleportationTravel();
                uiManager.PushWindow(DaggerfallUI.Instance.DfTravelMapWindow);
                break;

            case GuildServices.DaedraSummoning:
                DaedraSummoningService((int)npcService);
                break;

            case GuildServices.ReceiveArmor:
                ReceiveArmorService();
                break;

            case GuildServices.ReceiveHouse:
                ReceiveHouseService();
                break;

            case GuildServices.Spymaster:
                const int            spyMasterGreetingTextId = 402;
                DaggerfallMessageBox msgBox = new DaggerfallMessageBox(uiManager, this);
                msgBox.SetTextTokens(DaggerfallUnity.Instance.TextProvider.GetRandomTokens(spyMasterGreetingTextId));
                msgBox.ClickAnywhereToClose = true;
                msgBox.OnClose += SpyMasterGreetingPopUp_OnClose;
                msgBox.Show();
                break;

            case GuildServices.BuySoulgems:
                DaggerfallUI.Instance.PlayOneShot(SoundClips.ButtonClick);
                CloseWindow();
                tradeWindow = (DaggerfallTradeWindow)UIWindowFactory.GetInstanceWithArgs(UIWindowType.Trade, new object[] { uiManager, this, DaggerfallTradeWindow.WindowModes.Buy, guild });
                tradeWindow.MerchantItems = GetMerchantMagicItems(true);
                uiManager.PushWindow(tradeWindow);
                break;

            default:
                CloseWindow();
                Services.CustomGuildService customService;
                if (Services.GetCustomGuildService((int)service, out customService))
                {
                    customService(this);
                }
                else
                {
                    DaggerfallUI.MessageBox("Guild service not yet implemented.");
                }
                break;
            }
        }
        private void ConfirmSummon_OnButtonClick(DaggerfallMessageBox sender, DaggerfallMessageBox.MessageBoxButtons messageBoxButton)
        {
            sender.CloseWindow();
            if (messageBoxButton == DaggerfallMessageBox.MessageBoxButtons.Yes)
            {
                PlayerEntity playerEntity = GameManager.Instance.PlayerEntity;
                int          summonCost   = FormulaHelper.CalculateDaedraSummoningCost(summonerFactionData.rep);

                if (playerEntity.GetGoldAmount() >= summonCost)
                {
                    playerEntity.DeductGoldAmount(summonCost);

                    WeatherManager weatherManager = GameManager.Instance.WeatherManager;

                    // Sheogorath has a 5% (15% if stormy) chance to replace selected daedra.
                    int sheoChance = (weatherManager.IsStorming) ? 15 : 5;
                    if (Dice100.Roll() <= sheoChance)
                    {
                        daedraToSummon = daedraData[8];
                    }

                    // Default 30% bonus is only applicable to some Daedra in specific weather conditions.
                    int bonus = 0;
                    if (daedraToSummon.bonusCond == Weather.WeatherType.Rain && weatherManager.IsRaining ||
                        daedraToSummon.bonusCond == Weather.WeatherType.Thunder && weatherManager.IsStorming ||
                        daedraToSummon.bonusCond == Weather.WeatherType.None)
                    {
                        bonus = 30;
                    }

                    // Get summoning chance for selected daedra and roll.
                    int chance = FormulaHelper.CalculateDaedraSummoningChance(playerEntity.FactionData.GetReputation(daedraToSummon.factionId), bonus);
                    int roll   = Dice100.Roll();
                    Debug.LogFormat("Summoning {0} with chance = {1}%, Sheogorath chance = {2}%, roll = {3}, summoner rep = {4}, cost: {5}",
                                    daedraToSummon.vidFile.Substring(0, daedraToSummon.vidFile.Length - 4), chance, sheoChance, roll, summonerFactionData.rep, summonCost);

                    if (roll > chance)
                    {   // Daedra stood you up!
                        DaggerfallUI.MessageBox(SummonFailed, this);
                        // Spawn daedric foes if failed at a witches coven.
                        if (summonerFactionData.ggroup == (int)FactionFile.GuildGroups.Witches)
                        {
                            GameObjectHelper.CreateFoeSpawner(true, daedricFoes[Random.Range(0, 5)], Random.Range(1, 4), 4, 64);
                        }
                        return;
                    }

                    // Has this Daedra already been summoned by the player?
                    if (playerEntity.FactionData.GetFlag(daedraToSummon.factionId, FactionFile.Flags.Summoned))
                    {
                        // Close menu and push DaggerfallDaedraSummoningWindow here for video and dismissal..
                        CloseWindow();
                        uiManager.PushWindow(UIWindowFactory.GetInstanceWithArgs(UIWindowType.DaedraSummoned, new object[] { uiManager, daedraToSummon, SummonBefore, this }));
                    }
                    else
                    {   // Record the summoning.
                        playerEntity.FactionData.SetFlag(daedraToSummon.factionId, FactionFile.Flags.Summoned);

                        // Offer the quest to player.
                        offeredQuest = GameManager.Instance.QuestListsManager.GetQuest(daedraToSummon.quest, summonerFactionData.id);
                        if (offeredQuest != null)
                        {
                            // Close menu and push DaggerfallDaedraSummoningWindow here for video and custom quest offer..
                            CloseWindow();
                            uiManager.PushWindow(UIWindowFactory.GetInstanceWithArgs(UIWindowType.DaedraSummoned, new object[] { uiManager, daedraToSummon, offeredQuest }));
                        }
                    }
                }
                else
                {   // Display customised not enough gold message so players don't need to guess the cost.
                    TextFile.Token[] notEnoughGold = DaggerfallUnity.Instance.TextProvider.GetRSCTokens(DaggerfallTradeWindow.NotEnoughGoldId);
                    TextFile.Token[] msg           = new TextFile.Token[] {
                        new TextFile.Token()
                        {
                            formatting = TextFile.Formatting.Text, text = TextManager.Instance.GetLocalizedText("serviceSummonCost1")
                        },
                        new TextFile.Token()
                        {
                            formatting = TextFile.Formatting.JustifyCenter
                        },
                        new TextFile.Token()
                        {
                            formatting = TextFile.Formatting.Text, text = TextManager.Instance.GetLocalizedText("serviceSummonCost2") + summonCost + TextManager.Instance.GetLocalizedText("serviceSummonCost3")
                        },
                        new TextFile.Token()
                        {
                            formatting = TextFile.Formatting.JustifyCenter
                        },
                        new TextFile.Token()
                        {
                            formatting = TextFile.Formatting.NewLine
                        },
                        notEnoughGold[0],
                        new TextFile.Token()
                        {
                            formatting = TextFile.Formatting.JustifyCenter
                        },
                    };
                    DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, uiManager.TopWindow);
                    messageBox.SetTextTokens(msg, this);
                    messageBox.ClickAnywhereToClose = false;
                    messageBox.Show();
                }
            }
        }
 private void SaveButton_OnMouseClick(BaseScreenComponent sender, Vector2 position)
 {
     uiManager.PushWindow(UIWindowFactory.GetInstanceWithArgs(UIWindowType.UnitySaveGame, new object[] { uiManager, DaggerfallUnitySaveGameWindow.Modes.SaveGame, this, false }));
 }
 protected virtual void SellButton_OnMouseClick(BaseScreenComponent sender, Vector2 position)
 {
     DaggerfallUI.Instance.PlayOneShot(SoundClips.ButtonClick);
     CloseWindow();
     uiManager.PushWindow(UIWindowFactory.GetInstanceWithArgs(UIWindowType.Trade, new object[] { uiManager, this, DaggerfallTradeWindow.WindowModes.Sell, null }));
 }