상속: MonoBehaviour
예제 #1
0
        private void Display_MenuChanged(object sender, MenuChangedEventArgs e)
        {
            if (e.OldMenu != null)
            {
                DialogueBox db = (e.OldMenu as DialogueBox);
                if (db != null)
                {
                    Dialogue d = (Dialogue)typeof(DialogueBox).GetField("characterDialogue", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(db);
                    if (d != null && d.speaker != null && d.speaker.Equals(stateMachine.companion))
                    {
                        if (d.Equals(stateMachine.actionDialogue))
                        {
                            HandleActionDialogue();
                        }

                        else if (d.Equals(stateMachine.locationDialogue))
                        {
                            seenDialogueForLocations[stateMachine.companion.currentLocation.Name] = true;
                            locationDialoguePushed = false;
                        }

                        else if (d.Equals(stateMachine.automaticDismissDialogue))
                        {
                            stateMachine.AutomaticDismiss();
                        }

                        stateMachine.companion.faceTowardFarmerTimer = 0;
                        stateMachine.companion.movementPause         = 0;
                    }
                }
            }
        }
예제 #2
0
        private static void GameEvents_QuarterSecondTick(object sender, System.EventArgs e)
        {
            if (Game1.activeClickableMenu is DialogueBox)
            {
                DialogueBox dialogueBox = (DialogueBox)Game1.activeClickableMenu;

                if (dialogueBox.isPortraitBox() && Game1.currentSpeaker != null)
                {
                    setVoice(Game1.currentSpeaker.Name);
                }
                else
                {
                    setVoice("default");
                }

                if (dialogueBox.getCurrentString() != lastDialog)
                {
                    currentText = dialogueBox.getCurrentString();
                    lastDialog  = dialogueBox.getCurrentString();
                }
            }
            else if (Game1.hudMessages.Count > 0)
            {
                if (Game1.hudMessages[Game1.hudMessages.Count - 1].Message != lastHud)
                {
                    setVoice("default");
                    currentText = Game1.hudMessages[Game1.hudMessages.Count - 1].Message;
                    lastHud     = Game1.hudMessages[Game1.hudMessages.Count - 1].Message;
                }
            }
        }
예제 #3
0
    public override void _Ready()
    {
        base._Ready();

        IntroDialogue        = GetNode <DialogueBox>("UI/IntroDialogue");
        IntroAnimationPlayer = GetNode <AnimationPlayer>("UI/IntroDialogue/AnimationPlayer");

        MainMenu = GetNode <Control>("UI/MainMenu");
        MainMenuAnimationPlayer = GetNode <AnimationPlayer>("UI/MainMenu/AnimationPlayer");
        StartButton             = GetNode <Button>("UI/MainMenu/StartButton");

        MasterVolumeLabel  = GetNode <Label>("UI/MainMenu/Volume/VBoxContainer/MasterVolume/Label");
        MasterVolumeSlider = GetNode <Slider>("UI/MainMenu/Volume/VBoxContainer/MasterVolume/Slider");

        SFXVolumeLabel  = GetNode <Label>("UI/MainMenu/Volume/VBoxContainer/SFXVolume/Label");
        SFXVolumeSlider = GetNode <Slider>("UI/MainMenu/Volume/VBoxContainer/SFXVolume/Slider");

        MusicVolumeLabel  = GetNode <Label>("UI/MainMenu/Volume/VBoxContainer/MusicVolume/Label");
        MusicVolumeSlider = GetNode <Slider>("UI/MainMenu/Volume/VBoxContainer/MusicVolume/Slider");

        WinAnimationPlayer = GetNode <AnimationPlayer>("UI/WinScreen/AnimationPlayer");

        UpdateMasterVolume(Settings.MasterVolume * 100);
        UpdateSFXVolume(Settings.SFXVolume * 100);
        UpdateMusicVolume(Settings.MusicVolume * 100);

        UpdateVolume();
    }
예제 #4
0
        // Use this for initialization
        void Start()
        {
            player      = GameObject.Find("Player");
            dialogueBox = GameObject.Find("DialogueBox").GetComponent <DialogueBox>();

            this.Controller.RunEvent(this.Actions, "on-start");
        }
        private void MenuEvents_MenuChanged(object sender, EventArgsClickableMenuChanged e)
        {
            if (Game1.activeClickableMenu is DialogueBox && (!(Game1.activeClickableMenu is PortraitureDialogueBoxNew)))
            {
                DialogueBox oldBox  = (DialogueBox)Game1.activeClickableMenu;
                NPC         speaker = Game1.currentSpeaker;

                if (oldBox.isPortraitBox() == true && speaker != null && speaker.Portrait != null)
                {
                    Dialogue dialogue = speaker.CurrentDialogue.Peek();

                    bool isLewis = (speaker != Game1.getCharacterFromName("Lewis"));

                    int count = 0;
                    if (isLewis && Game1.isFestival())
                    {
                        try
                        {
                            count = dialogue.getResponseOptions().Count;
                        }
                        catch { }
                    }


                    if (count == 0 || !isLewis || Game1.isFestival() == false)
                    {
                        Game1.activeClickableMenu = new PortraitureDialogueBoxNew(dialogue);
                    }
                }
            }
        }
예제 #6
0
    // DEPRECATED
    private static IEnumerator ShakeUIItem(DialogueBox ui)
    {
        //bool isShaking = true;

        float duration    = 0.5f;
        float timeElapsed = 0f;

        while (timeElapsed < duration)
        {
            timeElapsed += Time.deltaTime;
            float shakeX = Mathf.Pow(duration / 70f, duration) * Mathf.Sin(timeElapsed * 10f) * 500f;
            float shakeY = Mathf.Pow(duration / 70f, duration) * Mathf.Sin(timeElapsed * 50f) * 500f;
            //ui.uiDisplacement = Vector3.Lerp(ui.uiDisplacement, new Vector3(shakeX, shakeY, 0), Time.deltaTime*5f);
            ui.uiDisplacement = new Vector3(shakeX, 0, 0);
            yield return(new WaitForSecondsRealtime(Time.deltaTime));
        }

        yield return(new WaitForSecondsRealtime(duration));

        timeElapsed = 0f;
        while (timeElapsed < duration * 2)
        {
            timeElapsed += Time.deltaTime;
            Vector3.Lerp(ui.uiDisplacement, new Vector3(0, 0, 0), Time.deltaTime * 5f);
        }
    }
    public void ReadFile()
    {
        XmlDocument doc = new XmlDocument();

        doc.Load(pathToResources + XMLFile);
        XmlNodeList xmlNodes = doc.SelectNodes("doc");

        foreach (XmlNode n in xmlNodes)
        {
            foreach (XmlNode node in n.ChildNodes)
            {
                Debug.Log(node.Name);
                XmlElement element = (XmlElement)node;

                List <DialogueOption> options = new List <DialogueOption>();
                foreach (XmlNode option in node.SelectNodes("o"))
                {
                    XmlElement e = (XmlElement)option;
                    options.Add(new DialogueOption(e.GetElementsByTagName("nextId")[0].InnerText, e.GetElementsByTagName("c")[0].InnerText));
                }
                DialogueBox db = new DialogueBox(element.GetElementsByTagName("id")[0].InnerText, element.GetElementsByTagName("s")[0].InnerText, options.ToArray());
                dialogues.Add(db);
            }
        }
    }
예제 #8
0
        private static void Input_ButtonPressed(object sender, StardewModdingAPI.Events.ButtonPressedEventArgs e)
        {
            if (Game1.activeClickableMenu != null && Game1.player.currentLocation is MineShaft && Game1.player.currentLocation.lastQuestionKey == "UndergroundSecrets_Question")
            {
                IClickableMenu menu = Game1.activeClickableMenu;
                if (menu == null || menu.GetType() != typeof(DialogueBox))
                {
                    return;
                }

                DialogueBox     db    = menu as DialogueBox;
                int             resp  = db.selectedResponse;
                List <Response> resps = db.responses;

                if (resp < 0 || resps == null || resp >= resps.Count || resps[resp] == null)
                {
                    return;
                }
                Game1.player.currentLocation.lastQuestionKey = "";
                helper.Events.Input.ButtonPressed           -= Input_ButtonPressed;

                AnswerResult(resps[resp].responseKey);
                return;
            }
        }
예제 #9
0
    public override void OnInteract(Character character)
    {
        if (!isOpened)
        {
            isOpened = true;
            character.InventoryModel.AddItem(ItemInChest, ItemAmount);
            if (OpenChestSprite != null)
            {
                GetComponentInChildren <SpriteRenderer>().sprite = OpenChestSprite;
            }
            else
            {
                GetComponentInChildren <SpriteRenderer>().sprite = null;
                Debug.LogWarning("No open chest sprite found!");
            }

            if (!Interacted)
            {
                DialogueBox.Show(chestText);
                character.MovementModel.SetFrozen(true, true, true);
            }
        }
        if (!Interacted)
        {
            Interacted = true;
        }
        else
        {
            DialogueBox.Hide();
            Interacted = false;
            character.MovementModel.SetFrozen(false, false, true);
        }
    }
예제 #10
0
    void DoThings()
    {
        if (currentStage.things != null)
        {
            foreach (Thing t in currentStage.things)
            {
                switch (t.type)
                {
                case "dialogue":
                    DialogueBox box = dialogueBuilder.Build(t);
                    box.SetText(t.text);
                    if (currentStage.completion == "time")
                    {
                        box.LookedAt += StartTimer;
                    }
                    break;

                case "fetch":
                    FetchManager fm = gameObject.AddComponent <FetchManager>();
                    fm.Init(t, EndStage);
                    stageEnded += fm.Cleanup;
                    break;
                }
            }
        }
    }
예제 #11
0
        private void Display_RenderedActiveMenu(object sender, StardewModdingAPI.Events.RenderedActiveMenuEventArgs e)
        {
            if (!Config.ShowNumbers || Game1.activeClickableMenu == null || !(Game1.activeClickableMenu is DialogueBox) || !Helper.Reflection.GetField <bool>(Game1.activeClickableMenu, "isQuestion").GetValue())
            {
                return;
            }

            DialogueBox db = Game1.activeClickableMenu as DialogueBox;

            if (Helper.Reflection.GetField <int>(db, "characterIndexInDialogue").GetValue() < db.getCurrentString().Length - 1 || Helper.Reflection.GetField <bool>(db, "transitioning").GetValue())
            {
                return;
            }

            int             x = Helper.Reflection.GetField <int>(Game1.activeClickableMenu, "x").GetValue();
            int             y = Helper.Reflection.GetField <int>(Game1.activeClickableMenu, "y").GetValue();
            int             heightForQuestions = Helper.Reflection.GetField <int>(Game1.activeClickableMenu, "heightForQuestions").GetValue();
            List <Response> responses          = Helper.Reflection.GetField <List <Response> >(Game1.activeClickableMenu, "responses").GetValue();
            int             count     = responses.Count;
            int             responseY = y - (heightForQuestions - Game1.activeClickableMenu.height) + SpriteText.getHeightOfString((Game1.activeClickableMenu as DialogueBox).getCurrentString(), Game1.activeClickableMenu.width - 16) + 44;

            for (int i = 0; i < count; i++)
            {
                e.SpriteBatch.DrawString(Game1.dialogueFont, $"{i + 1}", new Vector2(x, responseY), Config.NumberColor, 0, Vector2.Zero, 0.4f, SpriteEffects.None, 0.86f);
                responseY += SpriteText.getHeightOfString(responses[i].responseText, Game1.activeClickableMenu.width) + 16;
            }
        }
    public override void EventTrigger()
    {
        foreach (Behaviour component in toggleComponent)
        {
            component.enabled = !SetDisabled;
        }

        if (audioSource)
        {
            if (soundClip)
            {
                GameObject audioObject = new GameObject();
                audioObject.name = "Audio Object";
                AudioSource source = audioObject.AddComponent <AudioSource>();
                source.clip = soundClip;
                source.Play();
                Destroy(audioObject, soundClip.length);
            }
        }

        if (dialogueText != "")
        {
            DialogueBox.Get().SetText(dialogueText);
            DialogueBox.Get().TriggerText(dialogueTime);
        }
    }
예제 #13
0
 void Start()
 {
     battleStarted    = false;
     render           = GetComponent <SpriteRenderer>();
     inRange          = false;
     dialogueReceiver = dialogueBox.GetComponent <DialogueBox>();
 }
예제 #14
0
 void Start()
 {
     render           = GetComponent <SpriteRenderer>();
     inRange          = false;
     dialogueReceiver = dialogueBox.GetComponent <DialogueBox>();
     typer            = theTyper.GetComponent <actionTyper>();
 }
예제 #15
0
    /// <summary>
    /// Called when the item will be used
    /// </summary>
    public bool OnUse()
    {
        //If the item could be used, play sound
        if (!UseOnInteractactable() && Use())
        {
            //Play use sound
            if (audioSource)
            {
                audioSource.clip = useSound;
                audioSource.Play();
            }

            //Destroy item if specified
            if (destroyOnUse)
            {
                playerInventory.RemoveFromInventory(item, 1);
                Destroy(gameObject);
            }

            //Show used message
            UpdateUseText();
            DialogueBox.Get().TriggerText(onUseMessage);

            return(true);
        }
        return(false);
    }
예제 #16
0
 public static void DialogueBox_receiveLeftClick_Postfix(DialogueBox __instance)
 {
     if (!__instance.transitioning && __instance.characterDialogue != null)
     {
         PlayDialogue(__instance.characterDialogue);
     }
 }
예제 #17
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.name == "EnemyWeapon")
     {
         TakeDamage();
     }
     if (other.gameObject.name == "Interactable")
     {
         SetInInteractRange(true);
     }
     if (other.gameObject.name == "Shard")
     {
         Physics.IgnoreCollision(other, GetComponent <CapsuleCollider>());
     }
     if (other.gameObject.name == "BossDialogueTrigger")
     {
         if (Progress == 8)
         {
             List <Page> dialogue = new List <Page>();
             dialogue.Add(new Page("You: Biggie-S!"));
             dialogue.Add(new Page("Biggie-S: ... ... ... ?"));
             dialogue.Add(new Page("You: You been messin' on our turf for too long - let's settle this right here, right now!"));
             dialogue.Add(new Page("Biggie-S: ... ... owo ... ..."));
             dialogue.Add(new Page("You: That's it - you're going down, m*therfucker!"));
             DialogueBox dialogueBox = canvas.transform.Find("DialogueBox").GetComponent <DialogueBox>();
             dialogueBox.StartConversation(dialogue);
             other.gameObject.SetActive(false);
             Progress = 9;
             ui.Save();
         }
     }
 }
예제 #18
0
        public void OnUpdate(object sender, EventArgs args)
        {
            if (dialogActions.Count < 1 && !wait)
            {
                GameEvents.EighthUpdateTick -= OnUpdate;
            }

            if (wait && waitTickCount >= 0)
            {
                waitTickCount--;
            }
            else
            {
                wait = false;
            }

            if (waitTickCount == 3)
            {
                FinishTextPrinting();
            }

            if (waitTickCount == 0)
            {
                waitAction?.Invoke();
            }

            if (Game1.activeClickableMenu is DialogueBox dialogueBox && !ReferenceEquals(dialogueBox, previousDialogBox))
            {
                previousDialogBox  = dialogueBox;
                transitioningField = helper.Reflection.GetField <bool>(Game1.activeClickableMenu, "transitioning");
            }
예제 #19
0
 public void CheckCode()
 {
     if (currentCode == keypadCode)
     {
         isLocked      = false;
         currentCode   = "UNLOCKED";
         codeText.text = currentCode;
         if (audioSource)
         {
             audioSource.clip = unlockSound;
             audioSource.Play();
         }
     }
     else
     {
         currentCode   = "";
         codeText.text = currentCode;
         DialogueBox.Get().TriggerText(lockedMessage);
         if (audioSource)
         {
             audioSource.clip = lockedSound;
             audioSource.Play();
         }
     }
 }
    void GunDisabled()
    {
        //WEAPON DESTROYED
        if (gameObject.GetComponentInParent <EnemyShipModular>() != null)
        {
            DialogueBox.PrintToDBox(gameObject.name + " destroyed", gameObject.GetComponentInParent <EnemyShipModular>().gameObject);
        }

        if (winDrop != null)
        {
            Instantiate(winDrop, transform.position, transform.rotation);
        }

        if (splode != null)
        {
            Instantiate(splode, transform.position, transform.rotation);
        }

        //gameObject Disappears
        GetComponentInChildren <EnemyGunTurret>().Rest();

        timeSpentRepairing += Time.deltaTime;

        if (timeSpentRepairing > timeToRepair)
        {
            RestoreGun();
        }
    }
예제 #21
0
 protected void SetupDialogueBox()
 {
     if(dialogueBox == null){
         GameObject prefabInstance = GameObject.Instantiate(dialogueBoxPrefab);
         dialogueBox = prefabInstance.transform.GetChild(0).GetComponent<DialogueBox>();
     }
     else {
         dialogueBox.CleanChoices();
     }
     dialogueBox.parentAction = this;
     Dialogue.Choice choice;
     if(currentChoice == null){
         choice = nextChoices[0];
         foreach (var nextChoice in nextChoices) {
             dialogueBox.AddChoice(nextChoice);
         }
     }
     else {
         choice = currentChoice;
         dialogueBox.AddChoice(currentChoice);
     }
     dialogueBox.SetTitle(choice.speaker);
     Sprite avatar = GetImageFromResources(choice.speaker);
     if(avatar != null) dialogueBox.SetAvatar(avatar);
     else dialogueBox.HideAvatar();
 }
예제 #22
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // textures
            textureMap = ContentFactory.TextureFactory(graphics);

            // sound effects
            soundEffects.Add("chest-opened", ContentFactory.LoadSound(@"..\..\..\..\Content\soundeffects\65 Treasure Chest Opening.wav", graphics));

            // songs
            // make a song map

            // fonts
            Font = Content.Load <SpriteFont>("font");

            // dialogue box
            dialogueBox = new DialogueBox(graphics)
            {
                Text = "Hello World! Press Enter or Button A to proceed.\n" +
                       "I will be on the next pane! " +
                       "And wordwrap will occur, especially if there are some longer words!\n" +
                       "Monospace fonts work best but you might not want Courier New.\n" +
                       "In this code sample, after this dialog box finishes, you can press the O key to open a new one."
            };
            dialogueBox.Initialize();
            updateContext.textureMap = textureMap;
        }
예제 #23
0
        public override void Initialize(Scene scene, JToken data)
        {
            dialogueBox = dialogueBox ?? scene.Canvas.GetElement <DialogueBox>();
            //CreateSensor(scene, new Circle(InteractionRadius));

            base.Initialize(scene, data);
        }
        public static bool DrawBox(DialogueBox dialogueBox, SpriteBatch spriteBatch, int xPos, int yPos, int boxWidth,
                                   int boxHeight)
        {
            if (!dialogueBox.transitionInitialized)
            {
                return(true);
            }
            if (!dialogueBox.isPortraitBox())
            {
                return(true);
            }
            if (dialogueBox.isQuestion)
            {
                return(true);
            }

            var viewportWidth  = (int)Math.Ceiling(Game1.viewport.Width / Game1.options.uiScale * Game1.options.zoomLevel);
            var viewportHeight = (int)Math.Ceiling(Game1.viewport.Height / Game1.options.uiScale * Game1.options.zoomLevel);

            dialogueBox.height = 250;
            dialogueBox.y      = viewportHeight - dialogueBox.height - 64;

            var gradientBackground = Game1.currentSeason == "winter" && ModEntry.Config.DarkerBackgroundInWinter
                            ? ModEntry.DarkerGradientSample
                            : ModEntry.GradientSample;

            spriteBatch.Draw(gradientBackground, new Rectangle(0, yPos, viewportWidth, viewportHeight - yPos), Color.White);

            return(false);
        }
예제 #25
0
    public void OpenDialogueBox()
    {
        dialogueBoxObj.SetActive(true);

        DialogueBox  box     = dialogueBoxObj.GetComponent <DialogueBox>();
        Conversation current = conversations[conversationNum];

        box.content = current.content;
        if (!current.repeated)
        {
            conversationNum += 1;
        }
        if (conversationNum >= conversations.Count)
        {
            conversationNum = 0;
        }
        if (current.absoluteNumber > 0)
        {
            current.absoluteNumber--;
        }
        if (current.absoluteNumber == 0)
        {
            conversations.Remove(current);
        }


        dialogueBoxObj.GetComponent <DialogueBox>().OpenWindow();
    }
예제 #26
0
 void DialogueBoxOnClick()
 {
     if (textsToShow.Count > 0)
     {
         DialogueBox.GetComponentInChildren <Text> ().text = textsToShow.Dequeue();
         int speaker = portraitsToShow.Dequeue();
         if (speaker == 0)
         {
             WitchPortrait.gameObject.SetActive(false);
             DialoguePortrait.gameObject.SetActive(true);
         }
         else
         {
             WitchPortrait.gameObject.SetActive(true);
             DialoguePortrait.gameObject.SetActive(false);
         }
     }
     else
     {
         DialogueBox.gameObject.SetActive(false);
         WitchPortrait.gameObject.SetActive(false);
         DialoguePortrait.gameObject.SetActive(false);
         canGetHint = true;
     }
 }
예제 #27
0
    public GameObject SpawnDialogueBox(GameObject head, params Dialogue[] dialogue)
    {
        Events.onDialogueBox = true;
        GameObject obj = poolDictionary["DialogueBox"].Dequeue();

        obj.SetActive(true);
        obj.transform.SetParent(References.rf.uiOverlay, false);
        poolDictionary["DialogueBox"].Enqueue(obj);
        DialogueBox db = obj.GetComponent <DialogueBox>();

        References.rf.currentDialogueBox = db;
        db.currentDialogue = dialogue;
        var newHead = Instantiate(head, db.head.transform.parent);

        newHead.transform.position   = db.head.transform.position;
        newHead.transform.localScale = db.head.transform.localScale;
        newHead.layer = 5;
        var sr = newHead.GetComponentsInChildren <SpriteRenderer>();

        foreach (var s in sr)
        {
            s.sortingLayerName = "UI";
        }
        newHead.name = "Head";
        Destroy(db.head);
        db.head = newHead;
        return(obj);
    }
예제 #28
0
    //Stimulates the monster to appear at an available spawn point
    public void SpawnEnemyNearby(int chance)
    {
        int randomChance = Random.Range(0, 101);

        if (randomChance <= chance)
        {
            //GameManager gameManager = GameManager.Get();
            for (int i = 0; i < spawnPoints.Length; i++)
            {
                Vector3 spawnPos        = spawnPoints[i].transform.position;
                float   distanceBetween = Vector3.Distance(playerRef.transform.position, spawnPos);
                Ray     ray             = new Ray(spawnPos, (playerRef.transform.position - spawnPos).normalized);


                if (distanceBetween < enemy.spawnRadiusMax && distanceBetween > enemy.spawnRadiusMin
                    /*&& Physics.Raycast(ray, distanceBetween, LayerMask.GetMask("Default"))*/)
                {
                    enemyRef.SetActive(true);
                    enemyRef.transform.position = spawnPos;
                    break;
                }
            }

            DialogueBox.Get().SetText("I think the enemy heard that..");
            DialogueBox.Get().TriggerText(2);
        }
    }
예제 #29
0
        internal static void HandleStormTotemInterception(DialogueBox box, double odds, double stormOdds)
        {
            bool          stormDialogue = false;
            List <string> lines         = ClimatesOfFerngill.Reflection.GetField <List <string> >(box, "dialogues").GetValue();

            if (lines.FirstOrDefault() == Game1.content.LoadString("Strings\\StringsFromCSFiles:Object.cs.12822"))
            {
                if (ClimatesOfFerngill.WeatherOpt.Verbose)
                {
                    ClimatesOfFerngill.Logger.Log($"Rain totem interception firing with roll {odds:N3} vs. odds {stormOdds:N3}");
                }

                // rain totem used, do your thing
                if (ClimatesOfFerngill.WeatherOpt.StormTotemChange)
                {
                    if (odds <= stormOdds)
                    {
                        if (ClimatesOfFerngill.WeatherOpt.Verbose)
                        {
                            ClimatesOfFerngill.Logger.Log("Replacing rain with storm..");
                        }

                        SDVUtilities.SetWeather(Game1.weather_lightning);
                        stormDialogue = true;
                    }
                }

                // change dialogue text
                lines.Clear();
                lines.Add(stormDialogue
                    ? ClimatesOfFerngill.Translator.Get("hud-text.desc_stormtotem")
                    : Game1.content.LoadString("Strings\\StringsFromCSFiles:Object.cs.12822"));
            }
        }
예제 #30
0
        private void Input_ButtonPressed(object sender, ButtonPressedEventArgs e)
        {
            //Monitor.Log($"last question key: {Game1.player?.currentLocation?.lastQuestionKey}");

            if (Context.CanPlayerMove && e.Button == Config.PatioWizardKey && Game1.player?.currentLocation == Game1.getFarm())
            {
                StartWizard();
            }
            else if (Game1.activeClickableMenu != null && Game1.player?.currentLocation?.lastQuestionKey?.StartsWith("CSP_Wizard_Questions") == true && Game1.player?.currentLocation == Game1.getFarm())
            {
                IClickableMenu menu = Game1.activeClickableMenu;
                if (menu == null || menu.GetType() != typeof(DialogueBox))
                {
                    return;
                }

                DialogueBox     db    = menu as DialogueBox;
                int             resp  = db.selectedResponse;
                List <Response> resps = db.responses;

                if (resp < 0 || resps == null || resp >= resps.Count || resps[resp] == null)
                {
                    return;
                }
                Monitor.Log($"Answered {Game1.player.currentLocation.lastQuestionKey} with {resps[resp].responseKey}");

                CSPWizardDialogue(Game1.player.currentLocation.lastQuestionKey, resps[resp].responseKey);
                return;
            }
        }
예제 #31
0
    private void SendText()
    {
        //Disgusting. But it works... I'd definitely revise this for bigger projects/multiplayer games
        DialogueBox db = GameObject.Find("DialogueBox").GetComponent <DialogueBox>();

        db.ReadText(textObject);
    }
    // Use this for initialization
	void Start ()
	{
	    anim = GetComponent<Animator>();
	    anim.enabled = false;
	    renderThing =  GetComponentInChildren<Renderer>();
	    renderThing.enabled = false;

	    dialogueThing = GetComponent<DialogueBox>();
	    dialogueThing.enabled = false;
	}
예제 #33
0
    /// <summary>
    /// Create a new dialogue box
    /// </summary>
    /// <param name="message">Message for the dialogue box</param>
    /// <param name="duration">Duration of the dialog box [0 = infinite]</param>
    public void NewDialogue(string message, float duration = 0.0f)
    {
        CurrentDialogue = this;

        OpenDialogue();
        DialogueMessage.text = message;

        if (duration > 0.0f)
            StartCoroutine(TimedDialogue(duration));
    }
    void Start()
    {
        mat = renderer.material;

        db = GlobalVars.database;
        im = GlobalVars.interact_mode;

        di = GlobalVars.dialogue_box;

        inv = GlobalVars.inventory;
    }
    void Start()
    {
        im = GlobalVars.interact_mode;
        rm = GlobalVars.room_manager;
        dia = GlobalVars.dialogue_box;

        /*
        GameObject camera = GameObject.Find ("Main Camera");
        if(camera)
            di = camera.GetComponent<DrawInventory>();
        else
            di = null;
            */
    }
예제 #36
0
    // Use this for initialization
    void Start()
    {
        cam = GameObject.Find("Main Camera");

        Sprite left = Resources.Load<Sprite>("Sprites/AndyAdvanceWars");
        Sprite right = Resources.Load<Sprite>("Sprites/AndyAdvanceWars-2");
        Sprite background = Resources.Load<Sprite>("Sprites/tmpbackground");

        cut = cam.AddComponent<CutScene>();
        box = cam.AddComponent<DialogueBox>();

        cut.SetSprites( left, right, background, cam.transform.position,false);

        lines = new List<string>();
        LoadLines("Assets/Resources/Dialogue/testdialogue.txt");
        box.SetText(lines[linenum]);
    }
    void Start()
    {
        room_visible = true;
        dia = GlobalVars.dialogue_box;

        room_cams = new Camera[rooms.Length];
        room_lis = new AudioListener[rooms.Length];
        for(int i = 0; i < rooms.Length; i++)
        {
            Camera c = (Camera)(rooms[i].GetComponentInChildren<Camera>());
            c.enabled = false; // turn off camera
            room_cams[i] = c;

            AudioListener al = (AudioListener)(rooms[i].GetComponentInChildren<AudioListener>());
            al.enabled = false;
            room_lis[i] = al;
        }

        EnterRoom (room_cur);
    }
예제 #38
0
    void Start()
    {
        DialogueOpen = false;
        options = new List<Button>();
        panels = new List<RectTransform>();

        CurrentDialogue = this;
    }