2024-10-16 00:03:41 +08:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using UniFramework.Event;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Game.EventDefine
|
|
|
|
|
|
{
|
|
|
|
|
|
public static class GameEventDefine
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 变化金币
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public class OverlyCoin : IEventMessage
|
|
|
|
|
|
{
|
|
|
|
|
|
public bool hasEcho;
|
|
|
|
|
|
public int overlyCoin;
|
|
|
|
|
|
|
|
|
|
|
|
public static void SendMessage (int overlyCoin , bool echo = false) => UniEvent.SendMessage (new OverlyCoin ()
|
|
|
|
|
|
{
|
|
|
|
|
|
hasEcho = echo,
|
|
|
|
|
|
overlyCoin = overlyCoin
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2024-10-19 03:04:15 +08:00
|
|
|
|
|
|
|
|
|
|
public class GlobalRunaway : IEventMessage
|
|
|
|
|
|
{
|
|
|
|
|
|
public float Duration { get; private set; }
|
|
|
|
|
|
|
|
|
|
|
|
private GlobalRunaway ()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static void SendMessage (float duration) => UniEvent.SendMessage (new GlobalRunaway () { Duration = duration });
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-10-16 00:03:41 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 改变游戏状态
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public class ChangeGameFsm : IEventMessage
|
|
|
|
|
|
{
|
|
|
|
|
|
public GameState State { get; private set; }
|
|
|
|
|
|
public object[] Args { get; private set; }
|
|
|
|
|
|
|
|
|
|
|
|
private ChangeGameFsm ()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static void SendMessage (GameState state , params object[] args)
|
|
|
|
|
|
{
|
|
|
|
|
|
var changeGameFsm = new ChangeGameFsm { State = state , Args = args };
|
|
|
|
|
|
UniEvent.SendMessage (changeGameFsm);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class ShowTextHub : IEventMessage
|
|
|
|
|
|
{
|
|
|
|
|
|
public string text;
|
|
|
|
|
|
public RectTransform rectTransform;
|
|
|
|
|
|
public Vector2 extDistance;
|
|
|
|
|
|
|
|
|
|
|
|
public Vector3 Position
|
|
|
|
|
|
{
|
|
|
|
|
|
//将rectTransform的对应方向点转换为世界坐标
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
var pos = rectTransform.position;
|
|
|
|
|
|
return pos + new Vector3 (this.extDistance.x , this.extDistance.y , 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private ShowTextHub ()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static void SendMessage (string text , RectTransform rectTransform , Vector2 extDistance = default)
|
|
|
|
|
|
{
|
|
|
|
|
|
var showTextHub = new ShowTextHub
|
|
|
|
|
|
{
|
|
|
|
|
|
text = text,
|
|
|
|
|
|
rectTransform = rectTransform,
|
|
|
|
|
|
extDistance = extDistance
|
|
|
|
|
|
};
|
|
|
|
|
|
UniEvent.SendMessage (showTextHub);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class ShowTipBox : IEventMessage
|
|
|
|
|
|
{
|
|
|
|
|
|
public string tipText;
|
|
|
|
|
|
public string content;
|
|
|
|
|
|
public RectTransform box;
|
|
|
|
|
|
public Vector2 extDistance;
|
|
|
|
|
|
|
|
|
|
|
|
private ShowTipBox ()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static void SendMessage (string tipText , string content, RectTransform box, Vector2 extDistance = default)
|
|
|
|
|
|
{
|
|
|
|
|
|
var showTipBox = new ShowTipBox
|
|
|
|
|
|
{
|
|
|
|
|
|
tipText = tipText,
|
|
|
|
|
|
content = content,
|
|
|
|
|
|
box = box,
|
|
|
|
|
|
extDistance = extDistance
|
|
|
|
|
|
};
|
|
|
|
|
|
UniEvent.SendMessage (showTipBox);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|