当前位置: 首页 > 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#专题篇】—核心章题单实践练习


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


在这里插入图片描述


相关文章:

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

&#x1f468;‍&#x1f4bb;个人主页&#xff1a;元宇宙-秩沅 &#x1f468;‍&#x1f4bb; hallo 欢迎 点赞&#x1f44d; 收藏⭐ 留言&#x1f4dd; 加关注✅! &#x1f468;‍&#x1f4bb; 本文由 秩沅 原创 &#x1f468;‍&#x1f4bb; 收录于专栏&#xff1a;就业…...

并行计算的一些知识点分享--并行系统,并行程序, 并发,并行,分布式

并行计算 核是个啥&#xff1f; 在并行计算中&#xff0c;“核”通常指的是处理器的核心&#xff08;CPU核心&#xff09;。每个核心都是一个独立的处理单元&#xff0c;能够执行计算任务。多核处理器指的是拥有多个这样核心的单一物理处理器&#xff0c;这样的设计可以允许多…...

设计模式:访问者模式

访问者模式&#xff08;Visitor Pattern&#xff09;是行为设计模式的一种&#xff0c;它使你能够在不修改对象结构的情况下&#xff0c;给对象结构中的每个元素添加新的功能。访问者模式将数据结构和作用于结构上的操作解耦&#xff0c;使得操作集合可相对自由地演化。 核心概…...

vivado Virtex-7 配置存储器器件

Virtex-7 配置存储器器件 下表所示闪存器件支持通过 Vivado 软件对 Virtex -7 器件执行擦除、空白检查、编程和验证等配置操作。 本附录中的表格所列赛灵思系列非易失性存储器将不断保持更新 &#xff0c; 并支持通过 Vivado 软件对其中所列非易失性存储器 进行擦除、…...

检测服务器环境,实现快速部署。适用于CRMEB_PRO/多店

运行效果如图&#xff1a; 最近被好多人问&#xff0c;本来运行的好好的&#xff0c;突然swoole就启动不了了。 本工具为爱发电&#xff0c;如果工具正好解决了您的需求。我会很开心 代码如下&#xff1a; """本脚本为爱发电by:网前雨刮器 """…...

Spring Security初探

url说明方法/login/oauth/authorize授权断点。无登录态时跳转到/authentication/require&#xff0c;有登录态时跳转到/loginorg.springframework.security.oauth2.provider.endpoint.AuthorizationEndpoint#authorize/authentication/require自己写的用于重定向到登录页面的ur…...

【Java代码审计】敏感信息泄漏篇

【Java代码审计】敏感信息泄漏篇 敏感信息泄露概述 敏感信息泄露概述 敏感信息是业务系统中对保密性要求较高的数据&#xff0c;通常包括系统敏感信息以及应用敏感信息 系统敏感信息指的是业务系统本身的基础环境信息&#xff0c;例如系统信息、中间件版本、代码信息&#xff…...

Windows Server 2012 R2 新增D盘分区

我们经常搭建windows版本的游戏时会要在D盘上操作&#xff0c;今天就介绍下新的服务器如何新增一个D盘。 在"开始"图标右边有个”服务器管理器“&#xff0c;单击点开 点开服务器管理器后&#xff0c;点击“工具”打开“计算机管理” 打开计算机管理后点击“存储”-…...

transformer与beter

transformer与beter 解码和编码器含义tokizer标记器和one-hot独热编码编码解码--语义较好的维度空间矩阵相乘--空间变换编码理解如何构造降维的嵌入矩阵--实现到达潜空间上面是基础&#xff0c;下面是transformer正文自注意力机制注意力分数--上下文修正系数为什么需要KQ两个矩…...

MySQL索引设计遵循一系列原则

高频查询与大数据量表&#xff1a;对查询频次较高且数据量较大的表建立索引。这是因为索引主要是为了加速查询过程&#xff0c;对于经常需要访问的表和数据&#xff0c;索引的效果最为显著。 选择合适索引字段&#xff1a;从WHERE子句中提取最佳候选列作为索引字段&#xff0c…...

windows窗口消息队列与消息过程处理函数

在Windows窗口应用程序中&#xff0c;消息队列和窗口过程函数是实现消息驱动机制的核心组件。 消息队列&#xff08;Message Queue&#xff09;&#xff1a; 消息队列是用于存储窗口消息的缓冲区。当用户与应用程序交互时&#xff0c;系统会将生成的消息插入到消息队列中&…...

【Chisel】chisel中怎么处理类似verilog的可变位宽和parameter

在 Chisel 中处理可变位宽和参数的方式与 Verilog 有一些不同&#xff0c;因为 Chisel 是建立在 Scala 语言之上的。以下是如何在 Chisel 中处理这些概念的方法&#xff1a; 参数化&#xff08;Parameters&#xff09; 在 Chisel 中&#xff0c;参数化是通过在模块构造函数中定…...

[Easy] leetcode-225/232 栈和队列的相互实现

一、用栈实现队列 1、题目 仅使用两个栈实现先入先出队列。队列应当支持一般队列支持的所有操作&#xff08;push、pop、peek、empty&#xff09;&#xff1a; 实现 MyQueue 类&#xff1a;void push(int x) 将元素 x 推到队列的末尾 int pop() 从队列的开头移除并返回元素 …...

Springboot+Vue项目-基于Java+MySQL的个人云盘管理系统(附源码+演示视频+LW)

大家好&#xff01;我是程序猿老A&#xff0c;感谢您阅读本文&#xff0c;欢迎一键三连哦。 &#x1f49e;当前专栏&#xff1a;Java毕业设计 精彩专栏推荐&#x1f447;&#x1f3fb;&#x1f447;&#x1f3fb;&#x1f447;&#x1f3fb; &#x1f380; Python毕业设计 &…...

Leetcode 116:填充每一个节点的下一个右侧节点指针

给定一个 完美二叉树 &#xff0c;其所有叶子节点都在同一层&#xff0c;每个父节点都有两个子节点。二叉树定义如下&#xff1a; struct Node {int val;Node *left;Node *right;Node *next; } 填充它的每个 next 指针&#xff0c;让这个指针指向其下一个右侧节点。如果找不到…...

AI智能分析赋能EasyCVR视频汇聚平台,为安全生产监管提供保障

一、背景需求 为提升公共及生产安全监管&#xff0c;深入贯彻落实中央关于智慧城市、数字乡村的部署要求&#xff0c;视频设备融合管理已成为视频治理的必然趋势。针对当前部分地区在视频监控系统建设中存在的问题&#xff0c;如重点地区视频监控系统建设零散、视频监控数据孤…...

Java设计模式 _结构型模式_外观模式

一、外观模式 1、外观模式 外观模式&#xff08;Facade Pattern&#xff09;是一种结构型模式。主要特点为隐藏系统的复杂性&#xff0c;并向客户端提供了一个客户端可以访问系统的接口。这有助于降低系统的复杂性&#xff0c;提高可维护性。当客户端与多个子系统之间存在大量…...

数据结构之----栈与队列

栈是限定仅在表尾进行插入和删除操作的线性表&#xff1b; 队列是只允许在一端进行插入操作&#xff0c;而另一端进行删除操作的线性表&#xff1b; 栈&#xff0c;允许插入和删除的一端称为栈顶&#xff0c;另一端称为栈底&#xff0c;特点后进先出。 插入操作称为进栈&#…...

如何在windows server下安装mysql5.7数据库,并使用Navicat Premium 15可视化工具新建数据库并读取数据库信息。

如何在windows server下安装mysql5.7数据库&#xff1f; MySQL :: Download MySQL Community Server (Archived Versions)https://downloads.mysql.com/archives/community/点击↑&#xff0c;然后选择对应版本和平台↓下载 将下载后的安装包放入固定目录&#xff08;这里以D:…...

Calendar 366 II for Mac v2.15.5激活版:智能日历管理软件

在繁忙的工作和生活中&#xff0c;如何高效管理日程成为了许多人的难题。Calendar 366 II for Mac&#xff0c;作为一款全方位的日历管理软件&#xff0c;以其独特的功能和优秀的用户体验&#xff0c;成为您的日程好帮手。 Calendar 366 II for Mac支持多种视图模式&#xff0c…...

react引入阿里矢量库图标

react引入阿里矢量库图标 登录阿里矢量库&#xff0c;将项目所需的图标放一起 react项目中新建文件夹MyIcon.js 3. 在页面中引入&#xff0c;其中type为图标名称...

部署Gerapy

1.Gerapy 是什么&#xff1f; Gerapy 是一款基于 Python 3 的分布式爬虫管理框架&#xff0c;它旨在简化和优化分布式爬虫的部署、管理和监控过程。 2.作用与功能&#xff1f; 2.1分布式管理&#xff1a; Gerapy 允许用户在多台机器上部署和管理Scrapy爬虫&#xff0c;实现爬虫…...

Github Benefits 学生认证/学生包 新版申请指南

本教程适用于2024年之后的Github学生认证申请&#xff0c;因为现在的认证流程改变了很多&#xff0c;所以重新进行了总结这方面的指南。 目录 验证教育邮箱修改个人资料制作认证文件图片转换Base64提交验证 验证教育邮箱 进入Email settings&#xff0c;找到Add email address…...

基于单片机的宠物智能投喂系统研究

目录 第一章 研究背景和意义.................................................................... 4 1.1 研究背景....................................................................................... 5 1.2 研究目的.............................................…...

Linux-笔记 常用命令

&#xff08;持续更新&#xff09; 1、压缩&#xff1a; tar -vcjf test1.tar.bz2 test1 tar -vczf test1.tar.gz test1 2、解压 tar -vxjf test1.tar.bz2 tar -vxzf test2.tar.gz 3、查找 find [路径] [参数] [文件名] : find / -name test* grep [参数] 关键字 路径&a…...

MySQL中,关于日期类型的那些事儿,你知道哪些?

在MySQL数据库中&#xff0c;除了前面我们聊到的数字类型和字符串类型&#xff0c;还有一个常用的数据类型&#xff1a;日期类型。在我们业务表中&#xff0c;基本上每个业务表都有日期类型&#xff0c;用于记录创建时间和修改时间。比如我们的用户表&#xff0c;一般除了要记录…...

【Chrome实用命令笔记】

文章目录 Chrome实用命令笔记1、chrome基本介绍2. 打开开发者工具&#xff08;DevTools&#xff09;方法一&#xff1a;快捷键方法二&#xff1a;右键菜单方法三&#xff1a;浏览器设置 2. 开发者工具面板Elements面板Console面板Sources面板Network面板Performance面板Memory面…...

【数据库】数据库事务原理

事务特性 https://blog.csdn.net/zxcyxg123/article/details/132020499 MVCC MVCC&#xff08;Multi-Version Concurrency Control&#xff09;&#xff0c;即多版本并发控制&#xff0c;是一种并发控制的方法&#xff0c;主要用于数据库管理系统中&#xff0c;以实现对数据库…...

LeetCode 106.从中序与后序遍历序列构造二叉树

LeetCode 106.从中序与后序遍历序列构造二叉树 1、题目 题目链接&#xff1a;106. 从中序与后序遍历序列构造二叉树 给定两个整数数组 inorder 和 postorder &#xff0c;其中 inorder 是二叉树的中序遍历&#xff0c; postorder 是同一棵树的后序遍历&#xff0c;请你构造并…...

Python中的compile()函数,动态编译代码的艺术

关注公众号【一点sir】&#xff0c;领取编程资料。 简介 在Python编程中&#xff0c;compile()函数是一个强大的工具&#xff0c;它允许开发者将字符串形式的Python代码动态编译成字节码。这为执行动态生成或从外部源接收的代码提供了极大的灵活性。这些字节码随后可以被Pytho…...