当前位置: 首页 > news >正文

【UnityRPG游戏制作】Unity_RPG项目_PureMVC框架应用

在这里插入图片描述


👨‍💻个人主页:@元宇宙-秩沅

👨‍💻 hallo 欢迎 点赞👍 收藏⭐ 留言📝 加关注✅!

👨‍💻 本文由 秩沅 原创
👨‍💻 收录于专栏:就业宝典

🅰️推荐专栏

⭐-软件设计师高频考点大全



文章目录

    • 前言
    • (==3==)PureMVC框架面板系统
        • **SetPanel**
        • **GamePanel**
        • statePanel
        • backPackPanel
        • RolePanel
        • SotrePanel
        • TipPanel
        • StartTipPanel
        • NPCTipPanel
        • GameOVerPanel
        • GamePassPanel(Clone)
    • 🅰️


前言

请添加图片描述



3PureMVC框架面板系统


在这里插入图片描述

SetPanel

在这里插入图片描述

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;//-------------------------------
//-------功能:  设置面板视图
//-------创建者:         -------
//------------------------------public class SetView : BasePanel
{public Button stayBtu;     //继续游戏按钮public Slider soundSlider; //音量滑动条    }
using PureMVC.Interfaces;
using PureMVC.Patterns.Mediator;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;//-------------------------------
//-------功能: 设置面板视图中介
//-------创建者:         -------
//------------------------------public class SetViewMediator : Mediator
{//铭牌名public static string NAME = "SetViewMediator";/// <summary>/// 构造函数/// </summary>public SetViewMediator() : base(NAME){}/// <summary>/// 重写监听感兴趣的通知的方法/// </summary>/// <returns>返回你需要监听的通知的名字数组</returns>public override string[] ListNotificationInterests(){return new string[] {};}/// <summary>/// 面板中组件设置(监听相关)/// </summary>/// <param name="stateView"></param>public void setView(SetView seteView){ViewComponent = seteView;seteView.stayBtu.onClick.AddListener(() =>{SendNotification(PureNotification.HIDE_PANEL, "SetPanel");});//音乐滑动条seteView.soundSlider.onValueChanged.AddListener((vlaue) => {PlayerContorller.GetInstance().audioClip.volume = vlaue;});}/// <summary>/// 玩家受伤逻辑/// </summary>public void Hurt(){}/// <summary>/// 重写处理通知的方法,处理通知,前提是完成通知的监听/// </summary>/// <param name="notification">通知</param>public override void HandleNotification(INotification notification){}}
GamePanel

在这里插入图片描述

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;//-------------------------------
//-------功能:  游戏面板视图
//-------创建者:         -------
//------------------------------public class GameView : BasePanel
{public Slider audioSliderVuale;  //音量滑动条public Button startBtu;    //开始按钮public Button tipBtu;      //游戏说明按钮}
using PureMVC.Interfaces;
using PureMVC.Patterns.Mediator;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;//-------------------------------
//-------功能:  游戏面板视图中介
//-------创建者:         -------
//------------------------------public class GameViewMediator : Mediator
{//铭牌名public static string NAME = "GameViewMediator";/// <summary>/// 构造函数/// </summary>public GameViewMediator() : base(NAME){}/// <summary>/// 重写监听通知的方法,返回需要的监听(通知)/// </summary>/// <returns>返回你需要监听的通知的名字数组</returns>public override string[] ListNotificationInterests(){return new string[] {//PureNotification.UPDATA_ROLE_INFO,//PureNotification.UPDATA_STATE_INFO};}/// <summary>/// 面板中组件设置(监听相关)/// </summary>/// <param name="gameView"></param>public void SetView(GameView   gameView){Debug.Log(gameView+"执行SetView");ViewComponent = gameView;//开始按钮逻辑监听gameView.startBtu.onClick.AddListener(()=>{Time.timeScale = 1;//取消游戏暂停SendNotification(PureNotification.HIDE_PANEL, "GamePanel");SendNotification(PureNotification.SHOW_PANEL, "StatePanel");});gameView.tipBtu .onClick.AddListener(() =>{SendNotification(PureNotification.SHOW_PANEL , "StartTipPanel");});//音乐滑动条gameView.audioSliderVuale .onValueChanged.AddListener((vlaue) =>{PlayerContorller.GetInstance().audioClip.volume = vlaue;});}/// <summary>/// 重写处理通知的方法,处理通知/// </summary>/// <param name="notification">通知</param>public override void HandleNotification(INotification notification){switch (notification.Name){//case PureNotification.UPDATA_STATE_INFO://    (ViewComponent as StateView).UpdateView(notification.Body as PlayerDataObj);//    break;}}
}
statePanel

在这里插入图片描述

using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;//-------------------------------
//-------功能:  状态面板视图
//-------创建者:         -------
//------------------------------public class StateView : BasePanel 
{//1.找控件public TextMeshProUGUI levelText;     //等级    public TextMeshProUGUI bloodValue;    //当前血量   public TextMeshProUGUI attackVaule;   //攻击力值   public float  blood ,maxBlood, attack;    public Slider hpSlider;    //玩家血条   public Slider expSlider;   //经验血条   public Slider bossSlider;  //Boss血条   public Button roleBtu;     //角色按钮   public Button backpackBtu; //背包按钮  public Image  weaponSprite;//当前武器  public Text damon;     //当前钻石的数量/// <summary>/// 2.更新面板视图View的显示数据/// </summary>public void UpdateView(PlayerDataObj data)   //此处选择的是MVC的思想,在这里些许有些耦合{Debug.Log("来更新了");if(data != null){blood = data.blood;attack = data.attack;maxBlood = data.maxBlood;   levelText.text = Convert.ToString(data.level);bloodValue.text = Convert.ToString(data.blood); attackVaule.text = Convert.ToString(data.attack); bossSlider.value = data.blood / data.maxBlood;weaponSprite.sprite = data.nowItem ;damon.text = Convert.ToString(PlayerContorller.GetInstance().damonNum ); }else{Debug.Log("date为空");}}/// <summary>/// 增加钻石/// </summary>public void UpdateDamon(){damon.text = PlayerContorller .GetInstance().damonNum .ToString ();}}
using PureMVC.Core;
using PureMVC.Interfaces;
using PureMVC.Patterns.Mediator;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;//-------------------------------
//-------功能:  状态面板视图中介
//-------创建者:         
//------------------------------/// <summary>
/// 状态面板视图中介
/// 固定:
/// 1.继承PureMVC的Mediator脚本
/// 2.写构造函数
/// 3.重写监听通知的方法
/// 4.重写处理通知的方法
/// 5.可选:重写注册时的方法
/// </summary>
public class StateViewMediator : Mediator
{   //铭牌名public static string NAME = "StateViewMediator";/// <summary>/// 构造函数/// </summary>public StateViewMediator() : base(NAME){}/// <summary>/// 重写监听感兴趣的通知的方法/// </summary>/// <returns>返回你需要监听的通知的名字数组</returns>public override string[] ListNotificationInterests(){return new string[] {PureNotification.UPDATA_STATE_INFO,PureNotification.PLAYER_INJURY ,PureNotification.LEVEL_UP ,PureNotification.UPDATA_WEAPON_INFO2,PureNotification .UPDATA_EXP,PureNotification.UPDATA_DAMON};}/// <summary>/// 面板中组件设置(监听相关)/// </summary>/// <param name="stateView"></param>public void setView(StateView stateView){ViewComponent = stateView;stateView.roleBtu.onClick.AddListener(()=>{//SendNotification(PureNotification.HIDE_PANEL, "StatePanel");SendNotification(PureNotification.SHOW_PANEL, "RolePanel");});stateView.backpackBtu.onClick.AddListener(() =>{//SendNotification(PureNotification.HIDE_PANEL, "StatePanel");SendNotification(PureNotification.SHOW_PANEL, "BackpackPanel");});   }/// <summary>/// 玩家受伤逻辑/// </summary>public void Hurt(){}/// <summary>/// 重写处理通知的方法,处理通知,前提是完成通知的监听/// </summary>/// <param name="notification">通知</param>public override void HandleNotification(INotification notification){switch (notification.Name){case PureNotification.UPDATA_STATE_INFO: //状态更新的处理逻辑(ViewComponent as StateView).UpdateView(notification.Body as PlayerDataObj);break;case PureNotification.PLAYER_INJURY : //玩家受伤命令的处理逻辑if (ViewComponent != null){StateView stateView = ViewComponent as StateView;int blood = Convert.ToInt32(notification.Body);stateView.blood -= blood ;stateView.blood = stateView.blood > stateView.maxBlood ? stateView.maxBlood : stateView.blood; //防止血条溢出float off = stateView.blood / stateView.maxBlood;stateView.hpSlider.value = off; //改变血条if(off <= 0)//如果血条变成0或者小于0,则玩家死亡{PlayerContorller.GetInstance().isDied = true;PlayerContorller.GetInstance().DiedEvent();//开启死亡}}break;    case PureNotification.UPDATA_WEAPON_INFO2 :  //玩家武器信息更新的处理逻辑if (ViewComponent != null){StateView stateView = ViewComponent as StateView;stateView.weaponSprite.sprite   = notification .Body as Sprite  ;stateView.weaponSprite.enabled = true;}break;case PureNotification.UPDATA_EXP ://玩家经验信息更新的处理逻辑if (ViewComponent != null){StateView stateView = ViewComponent as StateView;int exp = Convert.ToInt32(notification.Body);float off = exp / 100f;Debug.Log("来了"+off);stateView.expSlider .value = off; //改变经验条if(off >= 1 )  //经验条满{stateView.blood = stateView.maxBlood;if (!Facade.HasProxy (PlayerProxy.NAME))  //首先判断是否有该中介,没有就new一个{Facade.RegisterProxy(new PlayerProxy()); //注册该视图中介}//获取视图对应的代理PlayerProxy bm = Facade.RetrieveProxy(PlayerProxy.NAME) as PlayerProxy;bm.LevUp();  //数据升级的方法stateView.UpdateView(bm.Data as PlayerDataObj); //升级数据stateView.expSlider.value = 0;PlayerContorller.GetInstance().exp = 0; //经验条归位}}break;case PureNotification.UPDATA_DAMON:{if (ViewComponent != null){StateView stateView = ViewComponent as StateView;stateView.UpdateDamon(); //执行增加钻石的方法}break;}}}}
backPackPanel

在这里插入图片描述

using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.UI;//-------------------------------
//-------功能: 背包系统视图
//-------创建者:         
//------------------------------public class BackpackView : BasePanel
{public Button back; //退出按钮public GridLayoutGroup grid; /// <summary>/// 更新背包中的内容/// </summary>/// <param name="itemBtu"></param>public void AddItem(Button itemBtu){try{Destroy(itemBtu.transform.GetComponent<ShopItem>());   //移除该商品的脚本itemBtu.transform.AddComponent<PropItem>(); //重新添加脚本}catch { }//将传入的按钮设置为布局下面的子物体itemBtu.transform.SetParent (grid.gameObject.transform );itemBtu.transform.localScale = Vector3.one ;//初始化商品道具大小}}
RolePanel

在这里插入图片描述

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;//-------------------------------
//-------功能:  角色面板视图
//-------创建者:         -------
//------------------------------public class RoleView : BasePanel
{//1.找控件public Button back;        //退出public Text levelText;     //等级public Text maxBlood;      //最大血量public Text attackVaule;   //攻击力值public Text defenceVaule;  //防御力值public Text CriticalVaule; //暴击率public Image[] item; //武器栏图public GameObject[] role;  //显示角色选择/// <summary>/// 2.更新面板视图View的显示数据/// </summary>public void UpdateView(PlayerDataObj data)   //此处选择的是MVC的思想,在这里些许有些耦合{if (data != null){levelText.text = data.level.ToString();maxBlood.text  = data.maxBlood.ToString();attackVaule.text   = data.attack.ToString();defenceVaule.text  = data.denfence.ToString();CriticalVaule.text = data.strike.ToString();}else{Debug.Log("角色面板无法更新");}}/// <summary>/// 更新武器栏中的图片/// </summary>/// <param name="item"></param>public void UpdateWeaponItem(PlayerDataObj data){Debug.Log("更新武器");if (data.index < 3 && PlayerContorller.GetInstance().curWeaponNum >0){this.item[data.index].enabled = true;this.item[data.index++].sprite = data.nowItem;}      }
}
using PureMVC.Interfaces;
using PureMVC.Patterns.Mediator;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;//-------------------------------
//-------功能:  角色面板视图中介
//-------创建者:         -------
//------------------------------/// <summary>
/// 角色面板视图中介
/// 固定:
/// 1.继承PureMVC的Mediator脚本
/// 2.写构造函数
/// 3.重写监听通知的方法
/// 4.重写处理通知的方法
/// 5.可选:重写注册时的方法
/// </summary>
public class RoleViewMediator : Mediator
{//铭牌名public static string NAME = "RoleViewMediator";/// <summary>/// 构造函数/// </summary>public RoleViewMediator( ) : base(NAME){//可以去写创捷面板预设体的逻辑等}/// <summary>/// 重写监听通知的方法,返回需要的监听(通知)/// </summary>/// <returns>返回你需要监听的通知的名字数组</returns>public  override string[] ListNotificationInterests(){return new string[] { PureNotification.UPDATA_ROLE_INFO,PureNotification.UPDATA_WEAPON_INFO1};}public void SetView(RoleView roleView){Debug.Log(roleView + "执行SetView");ViewComponent = roleView;//开始按钮逻辑监听roleView.back.onClick.AddListener(() =>{SendNotification(PureNotification.HIDE_PANEL, "RolePanel");});}/// <summary>/// 重写处理通知的方法,处理通知/// </summary>/// <param name="notification">通知</param>public override void HandleNotification(INotification notification){switch (notification.Name){case  PureNotification.UPDATA_ROLE_INFO:if (ViewComponent != null){(ViewComponent as RoleView).UpdateView(notification.Body as PlayerDataObj);(ViewComponent as RoleView).UpdateWeaponItem(notification.Body as PlayerDataObj);}else { Debug.Log("为空"); }break;}}/// <summary>/// 可选:重写注册方法(他们需要到Facde中注册)/// </summary>public override void OnRegister(){base.OnRegister();}}
SotrePanel

在这里插入图片描述

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;//-------------------------------
//-------功能: 商城系统
//-------创建者:         -------
//------------------------------public class StoreView : BasePanel
{public GridLayoutGroup StoreGrid;public GridLayoutGroup BackGrid;public Button backBtu;public Button bugPack;//放入背包}
using PureMVC.Interfaces;
using PureMVC.Patterns.Mediator;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;//-------------------------------
//-------功能:          -------
//-------创建者:         -------
//------------------------------public class StoreViewMediator : Mediator
{//铭牌名public static string NAME = "StoreViewMediator";/// <summary>/// 构造函数/// </summary>public StoreViewMediator() : base(NAME){}/// <summary>/// 重写监听感兴趣的通知的方法/// </summary>/// <returns>返回你需要监听的通知的名字数组</returns>public override string[] ListNotificationInterests(){return new string[] {};}/// <summary>/// 面板中组件设置(监听相关)/// </summary>/// <param name="stateView"></param>public void setView(StoreView storeView){ViewComponent = storeView;if(ViewComponent == null) { Debug.Log("面板是空的"); }storeView.backBtu.onClick.AddListener(()=>{SendNotification(PureNotification.HIDE_PANEL, "StorePanel");});storeView.bugPack.onClick.AddListener(() =>{SendNotification(PureNotification.HIDE_PANEL, "StorePanel");});}/// <summary>/// 玩家受伤逻辑/// </summary>public void Hurt(){}/// <summary>/// 重写处理通知的方法,处理通知,前提是完成通知的监听/// </summary>/// <param name="notification">通知</param>public override void HandleNotification(INotification notification){switch (notification.Name){}}
}
TipPanel

在这里插入图片描述
在这里插入图片描述

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;//-------------------------------
//-------功能:  余额不足提示面板视图
//-------创建者:         -------
//------------------------------public class TipView : BasePanel
{public Button ok;
}
using PureMVC.Interfaces;
using PureMVC.Patterns.Mediator;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;//-------------------------------
//-------功能: 余额不足提示面板中介
//-------创建者:         -------
//------------------------------public class TipViewMediator : Mediator
{//铭牌名public static string NAME = "TipViewMediator";/// <summary>/// 构造函数/// </summary>public TipViewMediator() : base(NAME){}/// <summary>/// 重写监听感兴趣的通知的方法/// </summary>/// <returns>返回你需要监听的通知的名字数组</returns>public override string[] ListNotificationInterests(){return new string[] {};}/// <summary>/// 面板中组件设置(监听相关)/// </summary>/// <param name="stateView"></param>public void setView(TipView tipView){ViewComponent = tipView;if (ViewComponent == null) { Debug.Log("面板是空的"); }tipView.ok.onClick.AddListener(() =>{SendNotification(PureNotification.HIDE_PANEL, "TipPanel");});}/// <summary>/// 玩家受伤逻辑/// </summary>public void Hurt(){}/// <summary>/// 重写处理通知的方法,处理通知,前提是完成通知的监听/// </summary>/// <param name="notification">通知</param>public override void HandleNotification(INotification notification){switch (notification.Name){}}
}
StartTipPanel

在这里插入图片描述

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;//-------------------------------
//-------功能:  开始说明面板视图
//-------创建者:         -------
//------------------------------public class StartTipView : BasePanel
{public Button startBtu; }
using PureMVC.Interfaces;
using PureMVC.Patterns.Mediator;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;//-------------------------------
//-------功能:   开始说明面板视图中介
//-------创建者:         -------
//------------------------------public class StartTipViewMediator : Mediator
{//铭牌名public static string NAME = "StartTipViewMediator";/// <summary>/// 构造函数/// </summary>public StartTipViewMediator() : base(NAME){}/// <summary>/// 重写监听通知的方法,返回需要的监听(通知)/// </summary>/// <returns>返回你需要监听的通知的名字数组</returns>public override string[] ListNotificationInterests(){return new string[] {//PureNotification.UPDATA_ROLE_INFO,//PureNotification.UPDATA_STATE_INFO};}public void SetView(StartTipView startTipView){Debug.Log(startTipView + "执行SetView");ViewComponent = startTipView;//按钮逻辑监听startTipView.startBtu.onClick.AddListener(() =>{SendNotification(PureNotification.HIDE_PANEL, "GamePanel");SendNotification(PureNotification.HIDE_PANEL, "startTipPanel");SendNotification(PureNotification.SHOW_PANEL, "StatePanel");});}/// <summary>/// 重写处理通知的方法,处理通知/// </summary>/// <param name="notification">通知</param>public override void HandleNotification(INotification notification){switch (notification.Name){//case PureNotification.UPDATA_STATE_INFO://    (ViewComponent as StateView).UpdateView(notification.Body as PlayerDataObj);//    break;}}
}
NPCTipPanel

在这里插入图片描述

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;//-------------------------------
//-------功能: NPC交互面板视图
//-------创建者:         -------
//------------------------------public class NPCTipView : BasePanel
{public Button backBtu;
}
using PureMVC.Interfaces;
using PureMVC.Patterns.Mediator;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;//-------------------------------
//-------功能: NPC交互面板视图中介
//-------创建者:         -------
//------------------------------/// <summary>
/// 状态面板视图中介
/// 固定:
/// 1.继承PureMVC的Mediator脚本
/// 2.写构造函数
/// 3.重写监听通知的方法
/// 4.重写处理通知的方法
/// 5.可选:重写注册时的方法
/// </summary>
public class NPCTipViewMediator : Mediator
{//铭牌名public static string NAME = "NPCTipViewMediator";/// <summary>/// 构造函数/// </summary>public NPCTipViewMediator() : base(NAME){}/// <summary>/// 面板中组件设置(监听相关)/// </summary>public void SetView(NPCTipView npcTipView){Debug.Log(npcTipView + "执行SetView");ViewComponent = npcTipView;//出击按钮逻辑监听npcTipView.backBtu.onClick.AddListener(() =>{SendNotification(PureNotification.HIDE_PANEL, "NPCTipPanel");          });}/// <summary>/// 重写监听通知的方法,返回需要的监听(通知)/// </summary>/// <returns>返回你需要监听的通知的名字数组</returns>public override string[] ListNotificationInterests(){return new string[] {//PureNotification.UPDATA_ROLE_INFO,//PureNotification.UPDATA_STATE_INFO};}/// <summary>/// 重写处理通知的方法,处理通知/// </summary>/// <param name="notification">通知</param>public override void HandleNotification(INotification notification){switch (notification.Name){//case PureNotification.UPDATA_STATE_INFO://    (ViewComponent as StateView).UpdateView(notification.Body as PlayerDataObj);//    break;}}
}
GameOVerPanel

在这里插入图片描述

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;//-------------------------------
//-------功能: 失败面板视图
//-------创建者:         -------
//------------------------------public class DefeatView : BasePanel
{public Button restartBtu; //重新开始按钮public Button endBtu;     //结束按钮
}
using PureMVC.Interfaces;
using PureMVC.Patterns.Mediator;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;//-------------------------------
//-------功能:  失败面板视图中介
//-------创建者:         -------
//------------------------------/// <summary>
/// 状态面板视图中介
/// 固定:
/// 1.继承PureMVC的Mediator脚本
/// 2.写构造函数
/// 3.重写监听通知的方法
/// 4.重写处理通知的方法
/// 5.可选:重写注册时的方法
/// </summary>
public class DefeatViewMediator : Mediator
{//铭牌名public static string NAME = "DefeatViewMediator";/// <summary>/// 构造函数/// </summary>public DefeatViewMediator() : base(NAME){}/// <summary>/// 重写监听通知的方法,返回需要的监听(通知)/// </summary>/// <returns>返回你需要监听的通知的名字数组</returns>public override string[] ListNotificationInterests(){return new string[] {//PureNotification.UPDATA_ROLE_INFO,//PureNotification.UPDATA_STATE_INFO};}public void SetView(DefeatView defeatView){ViewComponent = defeatView;defeatView.restartBtu.onClick.AddListener(()=>{SendNotification(PureNotification.HIDE_PANEL ,"DefeatPanel");SceneManager.LoadScene(2);});defeatView.endBtu .onClick.AddListener(() => {SendNotification(PureNotification.HIDE_PANEL, "DefeatPanel");SceneManager.LoadScene(2);});}/// <summary>/// 重写处理通知的方法,处理通知/// </summary>/// <param name="notification">通知</param>public override void HandleNotification(INotification notification){switch (notification.Name){//case PureNotification.UPDATA_STATE_INFO://    (ViewComponent as StateView).UpdateView(notification.Body as PlayerDataObj);//    break;}}
}
GamePassPanel(Clone)

在这里插入图片描述

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;//-------------------------------
//-------功能: 通过游戏面板视图
//-------创建者:         -------
//------------------------------public class GamePassView : BasePanel
{public Button okenter;
}
using PureMVC.Interfaces;
using PureMVC.Patterns.Mediator;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;//-------------------------------
//-------功能:    通过游戏面板视图中介
//-------创建者:         -------
//------------------------------public class GamePassViewMediator : Mediator
{//铭牌名public static string NAME = "GamePassViewMediator";/// <summary>/// 构造函数/// </summary>public GamePassViewMediator() : base(NAME){}/// <summary>/// 重写监听感兴趣的通知的方法/// </summary>/// <returns>返回你需要监听的通知的名字数组</returns>public override string[] ListNotificationInterests(){return new string[] {};}/// <summary>/// 面板中组件设置(监听相关)/// </summary>/// <param name="stateView"></param>public void setView(GamePassView tipView2){ViewComponent = tipView2;if (ViewComponent == null) { Debug.Log("面板是空的"); }tipView2.okenter .onClick.AddListener(() =>{SendNotification(PureNotification.HIDE_PANEL, "GamePassPanel");SceneManager.LoadScene(2);});}/// <summary>/// 玩家受伤逻辑/// </summary>public void Hurt(){}/// <summary>/// 重写处理通知的方法,处理通知,前提是完成通知的监听/// </summary>/// <param name="notification">通知</param>public override void HandleNotification(INotification notification){switch (notification.Name){}}
}

🅰️


⭐【Unityc#专题篇】之c#进阶篇】

⭐【Unityc#专题篇】之c#核心篇】

⭐【Unityc#专题篇】之c#基础篇】

⭐【Unity-c#专题篇】之c#入门篇】

【Unityc#专题篇】—进阶章题单实践练习

⭐【Unityc#专题篇】—基础章题单实践练习

【Unityc#专题篇】—核心章题单实践练习


你们的点赞👍 收藏⭐ 留言📝 关注✅是我持续创作,输出优质内容的最大动力!


在这里插入图片描述


http://www.lryc.cn/news/347406.html

相关文章:

  • 并行计算的一些知识点分享--并行系统,并行程序, 并发,并行,分布式
  • 设计模式:访问者模式
  • vivado Virtex-7 配置存储器器件
  • 检测服务器环境,实现快速部署。适用于CRMEB_PRO/多店
  • Spring Security初探
  • 【Java代码审计】敏感信息泄漏篇
  • Windows Server 2012 R2 新增D盘分区
  • transformer与beter
  • MySQL索引设计遵循一系列原则
  • windows窗口消息队列与消息过程处理函数
  • 【Chisel】chisel中怎么处理类似verilog的可变位宽和parameter
  • [Easy] leetcode-225/232 栈和队列的相互实现
  • Springboot+Vue项目-基于Java+MySQL的个人云盘管理系统(附源码+演示视频+LW)
  • Leetcode 116:填充每一个节点的下一个右侧节点指针
  • AI智能分析赋能EasyCVR视频汇聚平台,为安全生产监管提供保障
  • Java设计模式 _结构型模式_外观模式
  • 数据结构之----栈与队列
  • 如何在windows server下安装mysql5.7数据库,并使用Navicat Premium 15可视化工具新建数据库并读取数据库信息。
  • Calendar 366 II for Mac v2.15.5激活版:智能日历管理软件
  • react引入阿里矢量库图标
  • 部署Gerapy
  • Github Benefits 学生认证/学生包 新版申请指南
  • 基于单片机的宠物智能投喂系统研究
  • Linux-笔记 常用命令
  • MySQL中,关于日期类型的那些事儿,你知道哪些?
  • 【Chrome实用命令笔记】
  • 【数据库】数据库事务原理
  • LeetCode 106.从中序与后序遍历序列构造二叉树
  • Python中的compile()函数,动态编译代码的艺术
  • 【考研数学】汤家凤“免单“数学题被吐槽‘太难’,老汤回应「怎么还有脸笑」,网友:这些题有毒!