From da45ccae4c4b03fa50308b442a04ccfd3de160e0 Mon Sep 17 00:00:00 2001
From: 薛之猫大王 <545626463@qq.com>
Date: Sun, 11 Jan 2026 14:53:58 +0800
Subject: [PATCH] 添加文档注释
---
Assets/Scripts/Hotfix/MVC/View_Mediator/Login/LoginMediator.cs | 35 ++++++++++++++++++++++++++++-------
Assets/Scripts/Hotfix/MVC/Base/AppFacade.cs | 13 ++++++++++++-
2 files changed, 40 insertions(+), 8 deletions(-)
diff --git a/Assets/Scripts/Hotfix/MVC/Base/AppFacade.cs b/Assets/Scripts/Hotfix/MVC/Base/AppFacade.cs
index 07e5c9d..a27a77d 100644
--- a/Assets/Scripts/Hotfix/MVC/Base/AppFacade.cs
+++ b/Assets/Scripts/Hotfix/MVC/Base/AppFacade.cs
@@ -223,6 +223,7 @@
/// 解耦:对象间解耦,互不直接依赖
/// 可扩展:新增中介者只需注册,无需修改现有代码
/// 可维护:统一管理对象关系,易于维护
+ /// 但是这里的中介者更像视图控制器
/// </summary>
public override void RegisterMediator(IMediator mediator)////注册视图控制器中介者
{
@@ -289,7 +290,17 @@
m_globalMap.Remove(mediatorName);
}
}
-
+ /// <summary>
+ /// 观察者模式:定义对象间的一对多依赖,让多个对象不需要直接交互,通过观察者协调
+ /// 工作原理:
+ /// 注册:将观察者与被观察者绑定
+ /// RegisterObserver(new Observer());
+ /// 触发:被观察者状态改变时通知观察者
+ /// AppFacade.GetInstance().SendNotification("PlayerInfoChanged", playerData);
+ /// 处理:观察者实现 HandleNotification 方法处理业务逻辑
+ /// 优势:
+ /// 解耦:对象间解耦,互不直接依赖
+ /// </summary>
public override void SendNotification(string notificationName, object body = null, string type = null)
{
base.SendNotification(notificationName, body, type);
diff --git a/Assets/Scripts/Hotfix/MVC/View_Mediator/Login/LoginMediator.cs b/Assets/Scripts/Hotfix/MVC/View_Mediator/Login/LoginMediator.cs
index f73a0c1..918fa8f 100644
--- a/Assets/Scripts/Hotfix/MVC/View_Mediator/Login/LoginMediator.cs
+++ b/Assets/Scripts/Hotfix/MVC/View_Mediator/Login/LoginMediator.cs
@@ -1,9 +1,9 @@
// ===============================================================================
-// Author : Gen By Tools
-// Create Time : Tuesday, December 24, 2019
-// Update Time : Tuesday, December 24, 2019
+// Author : 薛之猫
+// Create Time : Sunday, January 11, 2026
+// Update Time : Sunday, January 11, 2026
// Class Description : LoginMediator
-// Copyright IGG All rights reserved.
+// Copyright 虚幻骑士科技 All rights reserved.
// ===============================================================================
using UnityEngine;
@@ -16,20 +16,41 @@
using UnityEngine.UI;
namespace Game {
+ /// <summary>
+ /// 登录视图控制器中介者
+ /// </summary>
public class LoginMediator : GameMediator {
- #region Member
+ #region 成员
+ /// <summary>
+ /// 中介者名称,作为视图中介者的唯一标识符,用于在AppFacade中查找和注册,或者移除中介者
+ /// </summary>
public static string NameMediator = "LoginMediator";
+ /// <summary>
+ /// 玩家代理
+ /// </summary>
private PlayerProxy _playerProxy;
+ /// <summary>
+ /// 上次登录名称
+ /// </summary>
private string _lastLoginName;
+ /// <summary>
+ /// 网络代理
+ /// </summary>
private NetProxy m_netProxy;
#endregion
- //IMediatorPlug needs
+ /// <summary>
+ /// 构造函数,构造的视图组件交给中介者管理
+ /// </summary>
+ /// <param name="viewComponent">视图组件</param>
public LoginMediator(object viewComponent ):base(NameMediator, viewComponent ) {}
+ /// <summary>
+ /// 登录视图
+ /// </summary>
public LoginView view;
private string m_serverIP;
@@ -50,7 +71,7 @@
- #region UI template method
+ #region UI 模板方法
public override void OpenAniEnd(){
--
Gitblit v1.10.0