【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.xdnf.cn/news/1420905.html

如若内容造成侵权/违法违规/事实不符,请联系一条长河网进行投诉反馈,一经查实,立即删除!

相关文章

Google与哈佛大学的科学家团队共同创造了一张人脑中一个极小部分的精细地图

每周跟踪AI热点新闻动向和震撼发展 想要探索生成式人工智能的前沿进展吗&#xff1f;订阅我们的简报&#xff0c;深入解析最新的技术突破、实际应用案例和未来的趋势。与全球数同行一同&#xff0c;从行业内部的深度分析和实用指南中受益。不要错过这个机会&#xff0c;成为AI领…

《为什么伟大不能被计划》对创意、创新和创造的自由探索 - 三余书屋 3ysw.net

为什么伟大不能被计划&#xff1a;对创意、创新和创造的自由探索 大家好&#xff0c;今天我们要讲述的书是由肯尼斯斯坦利和乔尔雷曼撰写的《为什么伟大不能被计划》&#xff0c;副标题是“对创意、创新和创造的自由探索”。光听这两位作者的名字&#xff0c;斯坦利和雷曼&…

鸿蒙开发接口Ability框架:【(AbilityContext)】

AbilityContext AbilityContext是Ability的上下文环境&#xff0c;继承自Context。 AbilityContext模块提供允许访问特定于ability的资源的能力&#xff0c;包括对Ability的启动、停止的设置、获取caller通信接口、拉起弹窗请求用户授权等。 说明&#xff1a; 本模块首批接口…

【机器学习300问】86、简述超参数优化的步骤?如何寻找最优的超参数组合?

本文想讲述清楚怎么样才能选出最优的超参数组合。关于什么是超参数&#xff1f;什么是超参数组合&#xff1f;本文不赘述&#xff0c;在之前我写的文章中有详细介绍哦&#xff01; 【机器学习300问】22、什么是超参数优化&#xff1f;常见超参数优化方法有哪些&#xff1f;htt…

(Java)心得:LeetCode——19.删除链表的倒数第 N 个节点

一、原题 给你一个链表&#xff0c;删除链表的倒数第 n 个结点&#xff0c;并且返回链表的头结点。 示例 1&#xff1a; 输入&#xff1a;head [1,2,3,4,5], n 2 输出&#xff1a;[1,2,3,5]示例 2&#xff1a; 输入&#xff1a;head [1], n 1 输出&#xff1a;[]示例 3&…

Golang — map的使用心得和底层原理

map作为一种基础的数据结构&#xff0c;在算法和项目中有着非常广泛的应用&#xff0c;以下是自己总结的map使用心得、实现原理、扩容机制和增删改查过程。 1.使用心得&#xff1a; 1.1 当map为nil和map为空时&#xff0c;增删改查操作时会出现的不同情况 我们可以发现&#…

什么是数据平台——企业构建Data+AI的基础数据底座需要的决策参考

什么是数据平台 标准的解释是这样的 Wikipedia A data platform usually refers to a software platform used for collecting and managing data, and acting as a data delivery point for application and reporting software. 数据平台是指将各类数据进行整合、存储、处…

鸿蒙开发接口Ability框架:【 (Context模块)】

Context模块 Context模块提供了ability或application的上下文的能力&#xff0c;包括允许访问特定于应用程序的资源、请求和验证权限等。 说明&#xff1a; 本模块首批接口从API version 6开始支持。后续版本的新增接口&#xff0c;采用上角标单独标记接口的起始版本。 本模块…

Java代理Ⅱ

目录 静态代理的内存结构图 测试demo 内存图 关于为什么不能直接修改原方法&#xff0c;而是要用代理 参考文章 关于代理我之前写过一篇博客&#xff0c;基本已经讲的差不多了&#xff0c;有兴趣的读者可以去看看 Java代理 最近有了新的感悟&#xff0c;所以记录一下 静…

如何快速展示专业:掌握类的基本概念-类/方法/关键字/变量/数据类型/注释

在李笑来的《财富自由之路》中提到一种初学者快速入门的学习方法&#xff1a;快速掌握最小必要知识。 关于Java的类&#xff0c;最少必要知识就是本文提到的基本概念&#xff0c;掌握了这些基本概念&#xff0c;就对类有了基本的了解&#xff0c;为后续的深入学习和沟通奠定了基…

7.STL_string1.0(详细)

目录 1. 什么是STL 2. STL的版本 3. STL的六大组件 1. 为什么学习string类&#xff1f; 1.1 C语言中的字符串 2. 标准库中的string类 2.1 string类(了解) 2.2 string类的常用接口说明 1. string类对象的常见构造 2. string类对象的容量操作 reserve 3. string类对象…

体验MouseBoost PRO,让Mac操作更高效

还在为Mac的右键功能而烦恼吗&#xff1f;试试MouseBoost PRO for Mac吧&#xff01;这款强大的鼠标右键增强软件&#xff0c;能让你通过简单操作即可激活多种实用功能&#xff0c;让你的工作变得更加轻松。其高度定制化的设计&#xff0c;更能满足你的个性化需求。赶快下载体验…

【C++】string底层的实现原理(简单详细)

前言 本篇文章我将按照C文档库中的模块顺序来实现和讲解其实现原理&#xff0c;我们只讲各板块中常用的 目录 一&#xff0c;Member functions&#xff08;成员函数&#xff09; 二、Iterators&#xff08;迭代器&#xff09; 三、Capacity&#xff08;容器&#xff09; 常…

[AIGC] redis 持久化相关的几道面试题

文章目录 1. 什么是Redis持久化&#xff1f;2. Redis 的持久化机制是什么&#xff1f;各自的优缺点&#xff1f;2.1 RDB&#xff08;Redis DataBase&#xff09;&#xff0c;快照2.2 AOF&#xff08;Append Only File&#xff09;&#xff0c;日志 3. 优缺点是什么&#xff1f;…

【递归、回溯和剪枝】全排列 子集

0.回溯算法介绍 什么是回溯算法 回溯算法是⼀种经典的递归算法&#xff0c;通常⽤于解决组合问题、排列问题和搜索问题等。 回溯算法的基本思想&#xff1a;从⼀个初始状态开始&#xff0c;按照⼀定的规则向前搜索&#xff0c;当搜索到某个状态⽆法前进时&#xff0c;回退到前…

Electron、QT、WPF三强争霸,该支持谁呢?

Electron、QT、WPF都是跨平台的桌面应用开发框架&#xff0c;都是非常流行的&#xff0c;作为开发者该选用哪个呢&#xff1f;本文从多个角度分析一下。 一、定义 Electron、Qt 和 WPF 都是用于创建桌面应用程序的框架或工具&#xff0c;它们各自有着不同的特点和优势。 Elec…

插件:Best HTTP

一、简介 WebSocket WebSocket使得客户端和服务器之间的数据交换变得更加简单&#xff0c;允许服务端主动向客户端推送数据。在WebSocket API中&#xff0c;浏览器和服务器只需要完成一次握手&#xff0c;两者之间就直接可以创建持久性的连接&#xff0c;并进行双向数据传输。…

C++笔记(体系结构与内核分析)

1.OOP面向对象编程 vs. GP泛型编程 OOP将data和method放在一起&#xff0c;目的是通过封装、继承、多态提高软件的可维护性和可扩展性GP将data和method分开&#xff0c;可以将任何容器与任何算法结合使用&#xff0c;只要容器满足塞饭所需的迭代器类型 2.算法与仿函数的区别 …

Java8 ConcurrentHashMap 存储、扩容源码阅读

文章目录 1. 概述2. 入门实例3. 属性4. 核心方法4.1 put4.2 initTable4.3 transfer4.4 sizeCtl4.5 sizeCtl bug 1. 概述 ConcurrentHashMap 是线程安全且高效的 HashMap。 HashMap 可以看下我这篇 传送门 。 2. 入门实例 public class MyStudy {public static void main(St…

【从零开始学架构 架构基础】二 架构设计的复杂度来源:高性能复杂度来源

架构设计的复杂度来源其实就是架构设计要解决的问题&#xff0c;主要有如下几个&#xff1a;高性能、高可用、可扩展、低成本、安全、规模。复杂度的关键&#xff0c;就是新旧技术之间不是完全的替代关系&#xff0c;有交叉&#xff0c;有各自的特点&#xff0c;所以才需要具体…