事件监听的原理:比如改变玩家金币是一个事件,数据中心接受到要改变玩家金币的信息,金币发生变化的时候,通知每个注册过这个事件的界面(也就是这个事件的订阅者),要进行什么操作.
举个例子:我现在要点击一下按钮就让金币数加100
首先,我应该先顶一下金币发生改变
其次,
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerInfoManagerTest {
#region 单例模式
private static PlayerInfoManagerTest instance;
private PlayerInfoManagerTest()
{
}
public static PlayerInfoManagerTest Instance
{
get
{
if (instance