Esempio n. 1
0
    public IEnumerator NewGameRoutine(FadeImageEffect fade)
    {
        IsTransitioning = true;
        TransitionData data = IndexDatabase.Instance().Transitions.GetData("fade_long");

        Global.Instance().Messenger.SetNextScript("y!sms/1_01", true);
        Global.Instance().Messenger.SetNextScript("bell/bell", true);
        Global.Instance().Data.SetSwitch("nighttime", true);
        Global.Instance().Audio.PlayBGM("nighttime");
        yield return(SceneManager.LoadSceneAsync("Map2D"));

        MapOverlayUI.Instance().pcSystem.SetNewsModel(IndexDatabase.Instance().PCNews.GetData("day1"));
        Global.Instance().Maps.RawTeleport("Apartment/Apartment", "start", OrthoDir.East);
        Avatar.PauseInput();
        var fadeImage = Camera.GetComponent <FadeImageEffect>();

        yield return(fadeImage.FadeRoutine(IndexDatabase.Instance().Fades.GetData(data.FadeOutTag), false, 0.0f));

        yield return(fadeImage.FadeRoutine(IndexDatabase.Instance().Fades.GetData(data.FadeInTag), true, 3.0f));

        yield return(CoUtils.RunTween(MapOverlayUI.Instance().miniPhone.transform.DOLocalMoveY(0.0f, 1.0f)));

        IsTransitioning = false;
        Avatar.UnpauseInput();
    }
    private void Message(DynValue senderLua, DynValue textLua, DynValue autotypeLua)
    {
        var phone = MapOverlayUI.Instance().phoneSystem.IsFlipped ? MapOverlayUI.Instance().bigPhone : MapOverlayUI.Instance().foreignPhone;

        if (autotypeLua.IsNil())
        {
            RunRoutineFromLua(phone.PlayMessageRoutine(senderLua.String, textLua.String));
        }
        else
        {
            var type  = autotypeLua.String;
            var delay = 4.4f;
            if (type == "short")
            {
                delay = 2.8f;
            }
            if (type == "long")
            {
                delay = 6.5f;
            }
            if (type == "micro")
            {
                delay = 0.8f;
            }
            RunRoutineFromLua(phone.PlayMessageRoutine(senderLua.String, textLua.String, delay));
        }
    }
Esempio n. 3
0
    private IEnumerator OpenRoutine()
    {
        var textbox = MapOverlayUI.Instance().textbox;

        if (encounterKey != null && encounterKey.Length > 0)
        {
            var party = IndexDatabase.Instance().Parties.GetData(encounterKey);
            yield return(BattleView.SpawnBattleRoutine(party));
        }
        else if (itemKey != null && itemKey.Length > 0)
        {
            if (isCollectable)
            {
                var collectable = IndexDatabase.Instance().Collectables.GetData(itemKey);
                Global.Instance().Audio.PlaySFX(sfxKey);
                Global.Instance().Data.Collectables.AddItem(collectable);
                Global.Instance().Data.SetSwitch(SwitchName, true);
                UpdateSprite();
                if (collectable.chestName != null && collectable.chestName.Length > 0)
                {
                    yield return(textbox.SpeakRoutine("Retrieved " + UIUtils.GlyphifyString(collectable.chestName) + "."));
                }
                else
                {
                    yield return(textbox.SpeakRoutine("Retrieved a " + UIUtils.GlyphifyString(collectable.displayName) + "."));
                }
            }
            else
            {
                var item = new CombatItem(IndexDatabase.Instance().CombatItems.GetData(itemKey));
                if (Global.Instance().Data.Inventory.IsFull())
                {
                    yield return(textbox.SpeakRoutine("No room for more items."));
                }
                else
                {
                    Global.Instance().Audio.PlaySFX(sfxKey);
                    Global.Instance().Data.Inventory.Add(item);
                    Global.Instance().Data.SetSwitch(SwitchName, true);
                    UpdateSprite();
                    if (isKey)
                    {
                        yield return(textbox.SpeakRoutine("Retrieved the " + item.Name + "."));
                    }
                    else
                    {
                        yield return(textbox.SpeakRoutine("Retrieved a " + item.Name + "."));
                    }
                }
            }
            yield return(textbox.DisableRoutine());
        }
        else
        {
            yield return(textbox.SpeakRoutine("Empty."));

            yield return(textbox.DisableRoutine());
        }
    }
Esempio n. 4
0
 public void UpdateFromMessenger()
 {
     if (MapOverlayUI.Instance() != null)
     {
         MapOverlayUI.Instance().bigPhone.UpdateFromMessenger(this);
         MapOverlayUI.Instance().miniPhone.UpdateFromMessenger(this);
     }
 }
Esempio n. 5
0
    private IEnumerator ClosedRoutine()
    {
        var textbox = MapOverlayUI.Instance().textbox;

        yield return(textbox.SpeakRoutine("Locked."));

        yield return(textbox.DisableRoutine());
    }
Esempio n. 6
0
    public override IEnumerator RunRoutine(LuaScript script)
    {
        yield return(base.RunRoutine(script));

        if (MapOverlayUI.Instance().textbox.isDisplaying)
        {
            yield return(MapOverlayUI.Instance().textbox.DisableRoutine());
        }
    }
 private void Flip()
 {
     if (MapOverlayUI.Instance().phoneSystem.IsFlipped)
     {
         RunRoutineFromLua(MapOverlayUI.Instance().phoneSystem.FlipRoutine());
     }
     else
     {
         RunRoutineFromLua(AvatarEvent.PhoneRoutine());
     }
 }
    private void Speak(DynValue speaker, DynValue text)
    {
        var speakerString = speaker.IsNil() ? null : speaker.String;
        var textString    = text.IsNil() ? null : text.String;

        if (speaker.String.Contains(":"))
        {
            textString    = speakerString.Split(':')[1].Substring(2);
            speakerString = speakerString.Split(':')[0];
        }
        RunTextboxRoutineFromLua(MapOverlayUI.Instance().textbox.SpeakRoutine(speakerString, textString));
    }
Esempio n. 9
0
    public override void RunRoutineFromLua(IEnumerator routine)
    {
        if (MapOverlayUI.Instance().textbox.isDisplaying)
        {
            routine = CoUtils.RunSequence(new IEnumerator[] {
                MapOverlayUI.Instance().textbox.DisableRoutine(),
                routine,
            });
        }

        base.RunRoutineFromLua(routine);
    }
Esempio n. 10
0
    private IEnumerator OpenRoutine()
    {
        var data    = IndexDatabase.Instance().CombatItems.GetData(itemKey);
        var textbox = MapOverlayUI.Instance().textbox;

        Global.Instance().Data.SetSwitch(SwitchName, true);
        yield return(textbox.SpeakRoutine("Used the " + UIUtils.GlyphifyString(data.abilityName) + "."));

        yield return(textbox.DisableRoutine());

        Event.IsSwitchEnabled = false;
    }
Esempio n. 11
0
    public static MapOverlayUI Instance()
    {
        Scene scene = SceneManager.GetActiveScene();

        if (_lastScene != scene)
        {
            _lastScene = scene;
            _instance  = null;
        }
        if (_instance == null)
        {
            _instance = FindObjectOfType <MapOverlayUI>();
        }
        return(_instance);
    }
 public override void RunRoutineFromLua(IEnumerator routine)
 {
     if (MapOverlayUI.Instance().textbox.isDisplaying)
     {
         // MapOverlayUI.Instance().textbox.MarkHiding();
         base.RunRoutineFromLua(CoUtils.RunSequence(new IEnumerator[] {
             MapOverlayUI.Instance().textbox.DisableRoutine(),
             routine,
         }));
     }
     else
     {
         base.RunRoutineFromLua(routine);
     }
 }
    public override IEnumerator RunRoutine(LuaScript script, bool canBlock)
    {
        if (canBlock && Global.Instance().Maps.Avatar != null)
        {
            Global.Instance().Maps.Avatar.PauseInput();
        }
        yield return(base.RunRoutine(script, canBlock));

        if (MapOverlayUI.Instance().textbox.isDisplaying)
        {
            yield return(MapOverlayUI.Instance().textbox.DisableRoutine());
        }
        if (canBlock && Global.Instance().Maps.Avatar != null)
        {
            Global.Instance().Maps.Avatar.UnpauseInput();
        }
    }
Esempio n. 14
0
    public IEnumerator ForeignPhoneRoutine(string key)
    {
        MapOverlayUI.Instance().foreignPhone.gameObject.SetActive(true);
        var phoneData         = IndexDatabase.Instance().ForeignPhones.GetData(key);
        var originalMessenger = Current;

        Current = new Messenger();
        foreach (var script in phoneData.toRun)
        {
            Current.SetNextScript(script, true);
        }
        MapOverlayUI.Instance().foreignPhone.SetMessenger(Current);
        yield return(MapOverlayUI.Instance().phoneSystem.FlipForeignRoutine());

        yield return(CoUtils.TaskAsRoutine(MapOverlayUI.Instance().foreignPhone.DoMenu()));

        yield return(MapOverlayUI.Instance().phoneSystem.FlipForeignRoutine());

        Current = originalMessenger;
        MapOverlayUI.Instance().foreignPhone.gameObject.SetActive(false);
    }
    public async Task DoMenu()
    {
        Populate(messenger);
        ConversationSelector.Selection = 0;
        while (true)
        {
            var index = await ConversationSelector.SelectItemAsync(null, true);

            if (index < 0)
            {
                break;
            }

            var convo = ConversationList.GetCell(index).GetComponent <ConversationCell>().Convo;
            await ShowConversation(convo);

            if (!MapOverlayUI.Instance().phoneSystem.IsFlipped&& !MapOverlayUI.Instance().phoneSystem.IsFlippedForeign)
            {
                break;
            }
        }
    }
Esempio n. 16
0
    public static IEnumerator PhoneRoutine()
    {
        if (Global.Instance().Data.GetSwitch("disable_phone") && !Global.Instance().Data.GetSwitch("stop_spam"))
        {
            yield break;
        }
        if (Global.Instance().Maps.Avatar != null)
        {
            Global.Instance().Maps.Avatar.PauseInput();
        }
        yield return(MapOverlayUI.Instance().phoneSystem.FlipRoutine());

        yield return(CoUtils.TaskAsRoutine(MapOverlayUI.Instance().bigPhone.DoMenu()));

        if (MapOverlayUI.Instance().phoneSystem.IsFlipped)
        {
            yield return(MapOverlayUI.Instance().phoneSystem.FlipRoutine());
        }
        if (Global.Instance().Maps.Avatar != null)
        {
            Global.Instance().Maps.Avatar.UnpauseInput();
        }
    }
 private void PanPhone()
 {
     MapOverlayUI.Instance().bigPhone.gameObject.transform.DOLocalMove(new Vector3(-410, 0), 1.0f).Play();
 }
    private void ForceConversation(DynValue clientLua)
    {
        var convo = Global.Instance().Messenger.GetConversation(clientLua.String);

        RunRoutineFromLua(CoUtils.TaskAsRoutine(MapOverlayUI.Instance().bigPhone.ShowConversation(convo)));
    }
 private void SwitchToSelectMode()
 {
     MapOverlayUI.Instance().bigPhone.SwitchToSelectMode();
 }
 private void SetSlideshow(DynValue keyLua)
 {
     MapOverlayUI.Instance().pcSystem.SetSlideshowModel(IndexDatabase.Instance().PCSlideshows.GetData(keyLua.String));
 }
 private void SetNews(DynValue keyLua)
 {
     MapOverlayUI.Instance().pcSystem.SetNewsModel(IndexDatabase.Instance().PCNews.GetData(keyLua.String));
 }
 private void StartPC()
 {
     RunRoutineFromLua(CoUtils.TaskAsRoutine(MapOverlayUI.Instance().pcSystem.DoMenuAsync()));
 }
 private void Video()
 {
     RunRoutineFromLua(MapOverlayUI.Instance().bigPhone.VideoRoutine());
 }
Esempio n. 24
0
 private void Speak2(DynValue speaker, DynValue face, DynValue text)
 {
     RunTextboxRoutineFromLua(MapOverlayUI.Instance().textbox.SpeakRoutine(speaker.String, text.String, (int)face.Number));
 }
Esempio n. 25
0
 private void Speak(DynValue speaker, DynValue text)
 {
     RunTextboxRoutineFromLua(MapOverlayUI.Instance().textbox.SpeakRoutine(speaker.String, text.String));
 }