102 lines
2.0 KiB
C#
102 lines
2.0 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using Godot;
|
|
using Godot.Bridge;
|
|
using Godot.Collections;
|
|
using Godot.NativeInterop;
|
|
|
|
[ScriptPath("res://Scripts/ShopCaller.cs")]
|
|
public partial class ShopCaller : Check
|
|
{
|
|
public enum Type
|
|
{
|
|
Auto = -1,
|
|
SchoolDW,
|
|
ChujinDW1,
|
|
ChujinDW2,
|
|
PenGuy,
|
|
PenGuy2
|
|
}
|
|
|
|
[Export(PropertyHint.None, "")]
|
|
public Type sprite;
|
|
|
|
[Export(PropertyHint.None, "")]
|
|
public Type bgType = Type.Auto;
|
|
|
|
[Export(PropertyHint.None, "")]
|
|
public Type dialog = Type.Auto;
|
|
|
|
[Export(PropertyHint.None, "")]
|
|
public ShopItems[] items;
|
|
|
|
[Export(PropertyHint.None, "")]
|
|
public AudioStream music;
|
|
|
|
[Export(PropertyHint.None, "")]
|
|
public AudioStream bleep;
|
|
|
|
[Export(PropertyHint.None, "")]
|
|
private Entity.Direction direction;
|
|
|
|
[Export(PropertyHint.None, "")]
|
|
public Array<int[]> talkReplacers;
|
|
|
|
[Export(PropertyHint.None, "")]
|
|
public Array<int[]> talkSetFlag;
|
|
|
|
private Shop shop;
|
|
|
|
public override void Interact()
|
|
{
|
|
if (CanDo())
|
|
{
|
|
CallShop();
|
|
}
|
|
else
|
|
{
|
|
Player.instance.canInput = true;
|
|
}
|
|
}
|
|
|
|
public void CallShop()
|
|
{
|
|
Main.inEvent = Coroutine.Start(DoShop());
|
|
}
|
|
|
|
private IEnumerator DoShop()
|
|
{
|
|
Party.StopMoving();
|
|
CameraController.Transition(Main.colorBlack, 30f, 1000);
|
|
while (!CameraController.transitionRoutine.done)
|
|
{
|
|
yield return null;
|
|
}
|
|
for (float a = 0f; a < 15f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
shop = GD.Load<PackedScene>("res://Objects/UI/Shop.tscn").Instantiate<Shop>(PackedScene.GenEditState.Disabled);
|
|
shop.SetUp(this);
|
|
CameraController.instance.AddChild(shop, forceReadableName: false, InternalMode.Disabled);
|
|
while (GodotObject.IsInstanceValid(shop))
|
|
{
|
|
yield return null;
|
|
}
|
|
Player.instance.direction = direction;
|
|
Player.instance.UpdateAnim(force: true);
|
|
for (float a = 0f; a < 15f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
Room.current.DoMusic();
|
|
CameraController.Transition(Main.colorClearB, 30f, 1000);
|
|
while (!CameraController.transitionRoutine.done)
|
|
{
|
|
yield return null;
|
|
}
|
|
}
|
|
|
|
}
|