上海虹口龙之梦项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

52 lines
1.5 KiB

using AX.MessageSystem;
using UnityEngine;
using UniRx;
public class FloorShortcuts : MonoBehaviour
{
public static FloorShortcuts Instance;
public int CurrentNumber;
public int Highest;
public int Lowest;
public string Buildingfilter;
private void Awake()
{
Instance = this;
}
// Start is called before the first frame update
void Start()
{
Observable.EveryLateUpdate()
.Where(_ => Input.GetKeyDown(KeyCode.PageUp))
.Subscribe(_ =>
{
if (CurrentNumber < Highest && CurrentNumber >= Lowest)
{
CurrentNumber++;
if (CurrentNumber == 0) CurrentNumber = 1;
}
if (CurrentNumber == Highest) { MainMenu.Instance.OnInterialClose(); CurrentNumber = Highest; }
else
{
MessageDispatcher.SendMessage("FLOORNUMBER", CurrentNumber, Buildingfilter);
}
}).AddTo(gameObject);
Observable.EveryLateUpdate()
.Where(_ => Input.GetKeyDown(KeyCode.PageDown))
.Subscribe(_ =>
{
if (CurrentNumber > Lowest && CurrentNumber <= Highest)
{
CurrentNumber--;
if (CurrentNumber == 0) CurrentNumber = -1;
MessageDispatcher.SendMessage("FLOORNUMBER", CurrentNumber, Buildingfilter);
}
});
}
}