Main/Component/UI/Common/FontSwitch.cs
@@ -15,16 +15,15 @@ [ExecuteAlways] private void Awake() { // TODO YYL // switch (m_FontType) // { // case FontType.Preferred: // text.font = FontUtility.preferred; // break; // case FontType.Secondary: // text.font = FontUtility.secondary; // break; // } switch (m_FontType) { case FontType.Preferred: text.font = FontUtility.preferred; break; case FontType.Secondary: text.font = FontUtility.secondary; break; } } public enum FontType Main/Component/UI/Common/FuncOpen.cs
@@ -4,7 +4,6 @@ using UnityEngine; using LitJson; // TODO YYL public class FuncOpen { private static FuncOpen _inst = null; @@ -20,51 +19,51 @@ protected FuncOpen() { // if (Application.isEditor) // { // if (!Application.isPlaying) return; // } if (Application.isEditor) { if (!Application.isPlaying) return; } // var allKeys = FuncOpenLVConfig.GetKeys(); // funcArray = new int[allKeys.Count]; // int _index = 0; // foreach (var key in allKeys) // { // int func = int.Parse(key); // funcOpenState[func] = false; // funcArray[_index] = func; // _index++; // } var allKeys = new List<int>(FuncOpenLVConfig.dic.Keys);//GetKeys(); funcArray = new int[allKeys.Count]; int _index = 0; foreach (var key in allKeys) { int func = key; funcOpenState[func] = false; funcArray[_index] = func; _index++; } // DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += BeforePlayerDataInitializeEvent; // DTC0102_tagCDBPlayer.switchAccountEvent += SwitchAccountEvent; DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += BeforePlayerDataInitializeEvent; DTC0102_tagCDBPlayer.switchAccountEvent += SwitchAccountEvent; // funcClientLVLimitDict.Clear(); // var jsonConfig = JsonMapper.ToObject(FuncConfigConfig.Get("FuncLevelLimitClient").Numerical1); // foreach (var key in jsonConfig.Keys) // { // funcClientLVLimitDict[int.Parse(key)] = int.Parse(jsonConfig[key].ToString()); // } funcClientLVLimitDict.Clear(); var jsonConfig = JsonMapper.ToObject(FuncConfigConfig.Get("FuncLevelLimitClient").Numerical1); foreach (var key in jsonConfig.Keys) { funcClientLVLimitDict[int.Parse(key)] = int.Parse(jsonConfig[key].ToString()); } } private void BeforePlayerDataInitializeEvent() { // for (int i = 0; i < funcArray.Length; i++) // { // funcOpenState[funcArray[i]] = false; // } for (int i = 0; i < funcArray.Length; i++) { funcOpenState[funcArray[i]] = false; } } private void SwitchAccountEvent() { // for (int i = 0; i < funcArray.Length; i++) // { // funcOpenState[funcArray[i]] = false; // if (OnFuncStateChangeEvent != null) // { // OnFuncStateChangeEvent(funcArray[i]); // } // } for (int i = 0; i < funcArray.Length; i++) { funcOpenState[funcArray[i]] = false; if (OnFuncStateChangeEvent != null) { OnFuncStateChangeEvent(funcArray[i]); } } } // TaskModel m_TaskModel; @@ -76,56 +75,56 @@ //纯客户端的功能等级限制, key 以功能配置表的FuncLevelLimitClient为准 //1. 精彩活动-全服红包显示等级 // public Dictionary<int, int> funcClientLVLimitDict = new Dictionary<int, int>(); public Dictionary<int, int> funcClientLVLimitDict = new Dictionary<int, int>(); public bool IsClientLVLimit(int key) { // if (!funcClientLVLimitDict.ContainsKey(key)) // return true; if (!funcClientLVLimitDict.ContainsKey(key)) return true; // if (PlayerDatas.Instance.baseData.LV >= funcClientLVLimitDict[key]) // return true; if (PlayerDatas.Instance.baseData.LV >= funcClientLVLimitDict[key]) return true; return false; } public void UpdateFuncState(/*HA302_tagMCFuncOpenStateList vNetData*/) public void UpdateFuncState(HA302_tagMCFuncOpenStateList vNetData) { // for (int i = 0; i < vNetData.FuncCount; i++) // { for (int i = 0; i < vNetData.FuncCount; i++) { // var funcState = vNetData.FuncStateList[i]; var funcState = vNetData.FuncStateList[i]; // bool bPerFuncIsOpen = false; // bool bAfterFuncIsOpen = false; bool bPerFuncIsOpen = false; bool bAfterFuncIsOpen = false; // if (!funcOpenState.ContainsKey(funcState.FuncID)) // { // funcOpenState.Add(funcState.FuncID, funcState.State == 1); // bAfterFuncIsOpen = true; // } // else // { // bPerFuncIsOpen = funcOpenState[funcState.FuncID]; // funcOpenState[funcState.FuncID] = funcState.State == 1; // bAfterFuncIsOpen = funcOpenState[funcState.FuncID]; // } // if (OnFuncStateChangeEvent != null) // { // OnFuncStateChangeEvent(funcState.FuncID); // } // } if (!funcOpenState.ContainsKey(funcState.FuncID)) { funcOpenState.Add(funcState.FuncID, funcState.State == 1); bAfterFuncIsOpen = true; } else { bPerFuncIsOpen = funcOpenState[funcState.FuncID]; funcOpenState[funcState.FuncID] = funcState.State == 1; bAfterFuncIsOpen = funcOpenState[funcState.FuncID]; } if (OnFuncStateChangeEvent != null) { OnFuncStateChangeEvent(funcState.FuncID); } } } private bool IsFuncOpen(int key, out int errorCode) { errorCode = 0; // var config = FuncOpenLVConfig.Get(key); // if (config == null) // { // return false; // } var config = FuncOpenLVConfig.Get(key); if (config == null) { return false; } // if (config.LimitMagicWeapon > 0) // { // Treasure treasure = null; @@ -152,64 +151,65 @@ // errorCode = 3; // return false; // } // if (config.LimitLV > 0 && PlayerDatas.Instance.baseData.LV < config.LimitLV) // { // errorCode = 1; // return false; // } // return true; return false; if (config.LimitLV > 0 && PlayerDatas.Instance.baseData.LV < config.LimitLV) { errorCode = 1; return false; } return true; // return false; } public bool IsFuncOpen(int key, bool tip = false) { bool isOpen = false; // if (funcOpenState.ContainsKey(key)) // isOpen = funcOpenState[key]; // if (!isOpen && tip) // ProcessorFuncErrorTip(key); if (funcOpenState.ContainsKey(key)) isOpen = funcOpenState[key]; if (!isOpen && tip) ProcessorFuncErrorTip(key); return isOpen; } public void ProcessorFuncErrorTip(int key) { // var config = FuncOpenLVConfig.Get(key); // if (config != null) // { // SoundPlayer.Instance.PlayUIAudio(SoundPlayer.defaultClickNegativeAudio); // if (config.Tip.Equals("FuncLimit_Level")) // { // SysNotifyMgr.Instance.ShowTip(config.Tip); // return; // } // var errorCode = 0; // if (!IsFuncOpen(key, out errorCode)) // { // switch (errorCode) // { // case 1: // SysNotifyMgr.Instance.ShowTip(config.Tip, Language.Get("OpenFunc4", config.LimitLV)); // break; // case 2: // var treasureConfig = TreasureConfig.Get(config.LimitMagicWeapon / 100); // SysNotifyMgr.Instance.ShowTip(config.Tip, Language.Get("OpenFunc1", treasureConfig != null ? treasureConfig.Name : string.Empty)); // break; // case 3: // SysNotifyMgr.Instance.ShowTip(config.Tip, UIHelper.GetRealmName(config.LimiRealmLV, true)); // break; // case 4: // if (config.LimitLV > 0) // { // SysNotifyMgr.Instance.ShowTip(config.Tip, Language.Get("OpenFunc2", config.LimitLV)); // } // else // { // SysNotifyMgr.Instance.ShowTip(config.Tip, Language.Get("OpenFunc3")); // } // break; // } // } // } var config = FuncOpenLVConfig.Get(key); if (config != null) { SoundPlayer.Instance.PlayUIAudio(SoundPlayer.defaultClickNegativeAudio); if (config.Tip.Equals("FuncLimit_Level")) { SysNotifyMgr.Instance.ShowTip(config.Tip); return; } var errorCode = 0; if (!IsFuncOpen(key, out errorCode)) { switch (errorCode) { case 1: SysNotifyMgr.Instance.ShowTip(config.Tip, Language.Get("OpenFunc4", config.LimitLV)); break; // TODO YYL // case 2: // var treasureConfig = TreasureConfig.Get(config.LimitMagicWeapon / 100); // SysNotifyMgr.Instance.ShowTip(config.Tip, Language.Get("OpenFunc1", treasureConfig != null ? treasureConfig.Name : string.Empty)); // break; // case 3: // SysNotifyMgr.Instance.ShowTip(config.Tip, UIHelper.GetRealmName(config.LimiRealmLV, true)); // break; case 4: if (config.LimitLV > 0) { SysNotifyMgr.Instance.ShowTip(config.Tip, Language.Get("OpenFunc2", config.LimitLV)); } else { SysNotifyMgr.Instance.ShowTip(config.Tip, Language.Get("OpenFunc3")); } break; } } } } public int GetLimitLv(int key) Main/Component/UI/Common/ItemBaseEffect.cs
@@ -1,8 +1,6 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; namespace vnxbqy.UI { public class ItemBaseEffect : MonoBehaviour { [SerializeField] UIEffect m_SuitEffect; @@ -153,5 +151,3 @@ } } } } Main/Component/UI/Core/TextImage.cs
@@ -19,8 +19,7 @@ protected override void Awake() { base.Awake(); // todo yyl // base.font = FontUtility.preferred; base.font = FontUtility.preferred; // base.material = MaterialUtility.hudMaterial; if (sprite != null) Main/Component/UI/Effect/TimeMgr.cs
@@ -23,24 +23,23 @@ { try { // TODO YYL // if (weekBuff != GetWeekOfYear(TimeUtility.ServerNow)) // { // if (OnWeekAfterPlayerDataInitializeEvent != null && DTC0102_tagCDBPlayer.isAfterPlayerDataInitialize) // { if (weekBuff != GetWeekOfYear(TimeUtility.ServerNow)) { if (OnWeekAfterPlayerDataInitializeEvent != null && DTC0102_tagCDBPlayer.isAfterPlayerDataInitialize) { // OnWeekAfterPlayerDataInitializeEvent(); // weekBuff = GetWeekOfYear(TimeUtility.ServerNow); // } // } // if (monthBuff != TimeUtility.ServerNow.Month) // { // if (OnMonthAfterPlayerDataInitializeEvent != null && DTC0102_tagCDBPlayer.isAfterPlayerDataInitialize) // { // OnMonthAfterPlayerDataInitializeEvent(); // monthBuff = TimeUtility.ServerNow.Month; // } // } OnWeekAfterPlayerDataInitializeEvent(); weekBuff = GetWeekOfYear(TimeUtility.ServerNow); } } if (monthBuff != TimeUtility.ServerNow.Month) { if (OnMonthAfterPlayerDataInitializeEvent != null && DTC0102_tagCDBPlayer.isAfterPlayerDataInitialize) { OnMonthAfterPlayerDataInitializeEvent(); monthBuff = TimeUtility.ServerNow.Month; } } if (dayBuff != TimeUtility.ServerNow.Day) { if (OnDayEvent != null) Main/Core/GameEngine/Launch/CheckAssetValidTask.cs
@@ -46,8 +46,7 @@ expectTime = timer; Debug.LogFormat("{0}执行时长:{1};", this.GetType().Name, timer); // TODO YYL // GameNotice.OpenGameNotice(); GameNotice.OpenGameNotice(); } public override void Update() Main/Core/GameEngine/Launch/InitSettingTask.cs
@@ -30,7 +30,6 @@ //ExceptionCatcher.Init(); //ExceptionCatcher.Catch(); // TODO YYL 如果没有 GlobalTimeEvent的话需要在场景加载的时候去加一个 GlobalTimeEvent.Instance.Begin(); PackageRegedit.Init(); Clock.Init(); Main/Core/GameEngine/Launch/LaunchInHot.cs
@@ -158,7 +158,6 @@ progressInfo = new LaunchProgressInfo(m_CurrentStage, 1, 1f, 1f); this.enabled = false; // 启动流程结束 要去哪里 LoginStage的处理 TODO YYL Main.Init(); // StageLoad.Instance.PushSceneLoadCommand(new StageLoad.StageLoadCommand() // { Main/Login/ServerListParser.cs
@@ -58,8 +58,7 @@ public void SetIsInWhiteList() { //TODO YYL //DebugUtility.Instance.isWhiteListAccount = serverInfoPlayer.white == 1; DebugUtility.Instance.isWhiteListAccount = serverInfoPlayer.white == 1; } Main/Manager/GameSystemManager/ChatBubbleManager.cs
New file @@ -0,0 +1,175 @@ using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class ChatBubbleManager : GameSystemManager<ChatBubbleManager> { public Dictionary<int, ChatBubble> chatBubbles = new Dictionary<int, ChatBubble>(); public event Action chatBubbleStateRefresh; bool serverInited = false; public override void Init() { PlayerDatas.Instance.playerDataRefreshEvent += PlayerDataRefreshInfoEvent; } public override void Release() { PlayerDatas.Instance.playerDataRefreshEvent -= PlayerDataRefreshInfoEvent; } public void OnBeforePlayerDataInitialize() { bubblesIfo.Clear(); serverInited = false; } public void OnPlayerLoginOk() { serverInited = true; } private void PlayerDataRefreshInfoEvent(PlayerDataType refreshType) { if (refreshType == PlayerDataType.ExAttr10 && serverInited) { SysNotifyMgr.Instance.ShowTip("ChangeBubbleSuccess"); } } public bool TryGetBubble(int id, out ChatBubble bubble) { return chatBubbles.TryGetValue(id, out bubble); } public bool IsBubbleGot(int id) { ChatBubble bubble; if (TryGetBubble(id, out bubble)) { // var config = ChatBubbleBoxConfig.Get(id); bool got = false; if (bubblesIfo.ContainsKey(id) && bubblesIfo[id].State == 1) { got = true; } // if (!got && config.NeedLV != 0) // { // return PlayerDatas.Instance.baseData.LV >= config.NeedLV; // } return got; } return false; } #region 服务端数据 //聊天气泡框 public struct BubbleBox { public int State; //是否已激活 public int EndTime; //到期时间戳,0为永久 public int Star; //星级 } public Dictionary<int, BubbleBox> bubblesIfo = new Dictionary<int, BubbleBox>(); public void UpdateBubbleState(HA717_tagMCChatBubbleBoxState package) { List<int> list = null; if (serverInited) { list = new List<int>(); foreach (var id in chatBubbles.Keys) { if (!IsBubbleGot(id)) { list.Add(id); } } } for (int i = 0; i < package.Count; i++) { var info = package.BoxList[i]; bubblesIfo[info.BoxID] = new BubbleBox() { State = info.State, EndTime = (int)info.EndTime, Star = info.Star, }; } if (serverInited) { if (list != null) { for (int i = 0; i < list.Count; i++) { if (IsBubbleGot(list[i])) { SendUseBubble(list[i]); break; } } } } if (chatBubbleStateRefresh != null) { chatBubbleStateRefresh(); } } public void SendUseBubble(int id) { if (!IsBubbleGot(id)) { return; } if (id == PlayerDatas.Instance.baseData.bubbleId) { return; } CA230_tagCMSetChatBubbleBox pak = new CA230_tagCMSetChatBubbleBox(); pak.BubbleBoxType = (byte)id; GameNetSystem.Instance.SendInfo(pak); } #endregion public struct ChatBubble { public int id; public RectOffset leftPadding; public RectOffset rifhtPadding; public Color32 color; public string GetBubbleIcon(bool left, ref bool isFlip) { return string.Empty; // var config = ChatBubbleBoxConfig.Get(id); // isFlip = false; // if (left) // { // if (string.IsNullOrEmpty(config.leftBubbleIcon)) // { // isFlip = true; // return config.rightBubbleIcon; // } // return config.leftBubbleIcon; // } // else // { // if (string.IsNullOrEmpty(config.rightBubbleIcon)) // { // isFlip = true; // return config.leftBubbleIcon; // } // return config.rightBubbleIcon; // } } } } Main/Manager/GameSystemManager/ChatBubbleManager.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: cd3d8f0df84e9824aaf1c2cbb4c033b0 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/Manager/GameSystemManager/ChatCenter.cs
@@ -301,19 +301,11 @@ { if (IsShowChatFloat()) { // TODO YYL // if (!UIManager.Instance.IsOpened<ChatFloatWin>()) // { // UIManager.Instance.OpenWindow<ChatFloatWin>(); // } if (!UIManager.Instance.IsOpened<ChatFloatWin>()) { UIManager.Instance.OpenWindow<ChatFloatWin>(); } } //else //{ // if (UIManager.Instance.IsOpened<ChatFloatWin>()) // { // UIManager.Instance.Close<ChatFloatWin>(); // } //} } bool openChatAfterCollect = false; @@ -350,12 +342,11 @@ } openChatAfterCollect = false; //TODO YYL // if (!UIManager.Instance.IsOpened<ChatWin>()) // { // ChatManager.Instance.presentChatType = ChatInfoType.Fairy; // UIManager.Instance.Open<ChatWin>(); // } if (!UIManager.Instance.IsOpened<ChatWin>()) { ChatManager.Instance.presentChatType = ChatInfoType.Fairy; UIManager.Instance.OpenWindow<ChatWin>(); } } Main/Manager/GameSystemManager/PackManager.cs
@@ -6,8 +6,6 @@ using System.Text.RegularExpressions; using System.Collections; namespace vnxbqy.UI { public class PackManager : GameSystemManager<PackManager> //public class PackModel : Model, IBeforePlayerDataInitialize, IAfterPlayerDataInitialize, IPlayerLoginOk { @@ -1902,4 +1900,3 @@ ItemLogicUtility.Instance.ShowGetItem(showItems, info, 0, eventName: eventName); } } } Main/Manager/GameSystemManager/TaskManager.cs
New file @@ -0,0 +1,1813 @@ using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using LitJson; using System.Text.RegularExpressions; using System.Text; using vnxbqy.UI; //任务信息的存储 /** 任务结构 */ public class MissionDetailDates { public DateTime Time;//记录时间 public int ID;//任务ID public string Name;//任务名称 public int Type;//任务类型 public int NPC_ID;//起始NPCID public int LV;//可接等级 public int ColorLV;//任务难度 public string Desclist;//任务详情 public string RewardList;//奖励信息 public List<TsakLight> LightList;//任务灯信息 public string InforList;//任务完成条件 public int MissionState;//任务状态0未接,1进行中,2可提交,3已完成,6特殊卡级 public int descIndex;//任务描述索引 } public class MissionDict//任务字典信息 { public int MissionId;//任务ID public int DictKeyLen;//任务字典中的某个Key public string DictKey;//key的长度 public int DictValue;//该key对应的值 } public class RunTaskAwardRecord { public int Num; public int AwardState; } public struct TsakLight { public int NpcId; public int StateLight; } public class TaskManager : GameSystemManager<TaskManager> { /** 任务总清单 */ public static bool _globalbool = false; public Dictionary<int, MissionDetailDates> allMissionDict = new Dictionary<int, MissionDetailDates>();//任务初始化接收字典 public Dictionary<int, MissionDetailDates> MainTaskDic = new Dictionary<int, MissionDetailDates>();//主线任务字典 public Dictionary<int, MissionDetailDates> SideQuestsDic = new Dictionary<int, MissionDetailDates>();//支线任务字典 public Dictionary<int, MissionDetailDates> BountyDic = new Dictionary<int, MissionDetailDates>();//赏金任务 public Dictionary<int, MissionDetailDates> FairyAuDic = new Dictionary<int, MissionDetailDates>();//仙盟任务 public int FairyAuTaskCount_Day { get; private set; } public int FairyAuTaskCount_Round { get; private set; } public Dictionary<int, MissionDetailDates> SpecialTask = new Dictionary<int, MissionDetailDates>();//特殊任务类型 public Dictionary<int, Dictionary<string, string>> _DicTaskInformation = new Dictionary<int, Dictionary<string, string>>();//任务字典的信息 public Dictionary<int, Dictionary<string, int>> ReplaceDic = new Dictionary<int, Dictionary<string, int>>();//key值替换字典 public Dictionary<int, RunTaskAwardRecord> AwardRecordDic = new Dictionary<int, RunTaskAwardRecord>();//跑环奖励记录 public Dictionary<int, int> NPCShowDic = new Dictionary<int, int>();//关于NPC的显隐问题 Dictionary<int, int> m_ShowNpcCache = new Dictionary<int, int>(); public delegate void OnTaskToAdd(int MissionID, int MissionState, int DiscriptionIndex); public static event OnTaskToAdd Event_TaskToAdd;//任务添加 public delegate void OnTaskRefreshes(int _taskId); public static event OnTaskRefreshes Event_TaskRefreshes;//任务的刷新 public delegate void OnBounty();//赏金任务的添加 public static event OnBounty Event_nBounty; public delegate void OnFairyAuTask();//仙盟任务的添加和刷新 public static event OnFairyAuTask Event_FairyAuTask; public delegate void OnTaskInformation(int _id, Dictionary<int, Dictionary<string, string>> _Dic); public static event OnTaskInformation Event_TaskInformation;//任务字典信息 public delegate void OnTaskToDelete(int _taskID); public static event OnTaskToDelete Event_TaskToDelete;//任务的删除 public delegate void OnBountyRewards(int Number, int AwardState);//获取赏金奖励 public static event OnBountyRewards Event_BountyRewards; public int BountyRewardsNumber = 0;//获取赏金内容的奖励值 public delegate void OnFairyAuReward(int Number, int AwardState);//仙盟奖励 public static event OnFairyAuReward Event_FairyAuReward; public int OnFairyAuNumber = 0;//获取仙盟的奖励值 public string _conversation = null;//对话内容、 public int _TaskNow = 0;//获取当前任务ID public string _DefaultDialogContent = null;//默认对话内容 public delegate void OnMainlineTask(int MissionID, int MissionState);//主线任务任务状态变更和刷新 public static event OnMainlineTask Event_MainlineTask; public delegate void OnTaskResponse(int _nowNPCid, int _nPCLamp, Dictionary<int, int> _dic = null);//NPCNPC灯状态,可接取任务(NPCID,任务灯状态) public static event OnTaskResponse Event_TaskResponse; public static event Action tryGetTaskAwardEvent;//这个是客户端只要尝试去领奖就会触发,不管最后的领奖结果。 public static event Action<int> CardLevelChange;//关于任务卡机状态的转变 public static event Action<int> SideQuestChangeEvent;//支线任务状态改变 public static event Action<int> MainCardLevelChange;//主线任务卡级状态改变 public static event Action<int> CompletionOfTaskEvent;//任务完成回调 public event Action<int> talkNpcIdUpdate; public event Action<int> taskDescriptionRefresh; public static event Action TaskCoinTaskEvent;//赏金任务信息字典变更 public static event Action FairyTaskEvent;//仙盟任务信息字典变更 public int NPCid = 0;//获取NPCID(打开任务面板时)、 public bool BountyMotionBool = false;//控制赏金任务是否自动移动 public bool FairyAuBool = false;//控制仙盟任务是否自动移动 public int currentMission { get; private set; } public int currentMissionState { get; private set; } public int GetNowTaskID { get; set; }//获取当前选中条的任务ID private bool isServerPrepare = false;//控制是否自动进行自动任务 private int retainTaskID = 0; private float BossDelayTimeint = 0; public Vector3 UIeffectFabaoVec = new Vector3();//法宝NPC消失时获取的坐标 //----关于前期无操作自动执行主线 public int TaskAutoLv = 0; public int TaskAutoTime = 0; public bool TaskOverBool = false; private int Times = 0; private int NeedWaitTime = 4; public int clientGuardDugeonTask { get; private set; } List<int[]> priorityTaskChains = new List<int[]>(); List<int> allowAutoTaskMapIds = new List<int>(); private float mainTaskAutoWaitTime = 0f; public readonly TaskWait taskWait = new TaskWait(); public List<int> npcImages = new List<int>(); public List<int> playerJobImages = new List<int>(); //跳转到任务,0为置顶 public event Action OnJumpTask; private int m_JumpTaskID = 0; public int jumpTaskID { get { return m_JumpTaskID; } set { m_JumpTaskID = value; OnJumpTask?.Invoke(); } } public override void Init() { // StageLoad.Instance.onStageLoadFinish += onStageLoadFinish; // NPCInteractProcessor.s_NpcInteractEvent += NpcInterac; string BossDelayTime = FuncConfigConfig.Get("BossDelayTime").Numerical1; BossDelayTimeint = float.Parse(BossDelayTime); var Task_Auto = FuncConfigConfig.Get("TaskAuto"); TaskAutoLv = int.Parse(Task_Auto.Numerical1); TaskAutoTime = int.Parse(Task_Auto.Numerical2); mainTaskAutoWaitTime = int.Parse(Task_Auto.Numerical3) / 1000f; var mapIds = ConfigParse.GetMultipleStr<int>(Task_Auto.Numerical4); if (mapIds != null && mapIds.Length > 0) { allowAutoTaskMapIds.AddRange(mapIds); } FairyAuTaskCount_Day = int.Parse(FuncConfigConfig.Get("RunTaskCnt").Numerical1.Split('|')[1].Split('_')[1]); FairyAuTaskCount_Round = int.Parse(FuncConfigConfig.Get("RunTaskCnt").Numerical2.Split('|')[1].Split('_')[1]); var cliengGuardConfig = FuncConfigConfig.Get("ClientGuardDungeon"); clientGuardDugeonTask = int.Parse(cliengGuardConfig.Numerical5); var funcConfig = FuncConfigConfig.Get("AutoSelectTaskChain"); var taskChainArray = LitJson.JsonMapper.ToObject<int[][]>(funcConfig.Numerical1); if (taskChainArray != null) { for (int i = 0; i < taskChainArray.Length; i++) { priorityTaskChains.Add(taskChainArray[i]); } } var config = FuncConfigConfig.Get("NPCTalk"); npcImages = JsonMapper.ToObject<List<int>>(config.Numerical1); playerJobImages = JsonMapper.ToObject<List<int>>(config.Numerical2); } public override void Release() { // StageLoad.Instance.onStageLoadFinish -= onStageLoadFinish; // NPCInteractProcessor.s_NpcInteractEvent -= NpcInterac; } public void OnBeforePlayerDataInitialize() { allMissionDict.Clear(); MainTaskDic.Clear(); SideQuestsDic.Clear(); BountyDic.Clear(); FairyAuDic.Clear(); SpecialTask.Clear(); _DicTaskInformation.Clear(); ReplaceDic.Clear(); AwardRecordDic.Clear(); NPCShowDic.Clear(); m_ShowNpcCache.Clear(); _conversation = null; _DefaultDialogContent = null; _TaskNow = 0; BountyRewardsNumber = 0; NPCid = 0; retainTaskID = 0; currentMission = 0; _globalbool = false; BountyMotionBool = false; FairyAuBool = false; isServerPrepare = false; } public void OnPlayerLoginOk() { GlobalTimeEvent.Instance.secondEvent -= secondEvent; GlobalTimeEvent.Instance.secondEvent += secondEvent; TaskAllocation.Instance.TaskTime = TimeUtility.ServerNow; isServerPrepare = true; TaskOverBool = false; } // private void onStageLoadFinish()//地图切换时调用 // { // var inDungeon = IsDungeon(); // if (!inDungeon && retainTaskID != 0) // { // if (ReplaceDic.ContainsKey(retainTaskID)) // { // AutomaticTripToTask(retainTaskID); // //int missionState = SideQuestState(retainTaskID); // //TaskTerminationToHangUp(retainTaskID, missionState); // retainTaskID = 0; // } // } // } List<int> ListMissionID = new List<int>(); public void RefreshMissionState(int MissionID, int MissionState, int DiscriptionIndex)//1.任务ID,2任务状态,3,任务描述Index(接收任务) { // TODO YYL // try // { // if (isServerPrepare && MissionState != 3 && MissionID != 2000 && MissionID != 3000) // { // TaskupToDate = MissionID; // } // var pytaskM = PyTaskConfig.Get(MissionID); // if (pytaskM == null) // { // return; // } // if ((pytaskM.type == (int)TaskTypenum.MainlineTaskType || pytaskM.type == (int)TaskTypenum.MainlineTaskTyp2) && MissionState != 0 && MissionState != 3) // { // currentMission = MissionID; // currentMissionState = MissionState; // } // //仙盟任务完成 // if ((pytaskM.type == 12 || pytaskM.type == 14) && TaskAllocation.Instance.FairyAuAllNumber() >= FairyAuTaskCount_Day) // { // Event_FairyAuTask(); // return; // } // if (allMissionDict.ContainsKey(MissionID)) // { // int missionState = allMissionDict[MissionID].MissionState; // var lastDescriptionIndex = allMissionDict[MissionID].descIndex; // if (allMissionDict[MissionID].MissionState != MissionState && MissionState == 3 && isServerPrepare) // { // TaskOverBool = true; // taskWait.Push(TaskWaitType.TaskComplete); // if (CompletionOfTaskEvent != null) // { // CompletionOfTaskEvent(MissionID); // } // } // TaskChanges(MissionID, MissionState, DiscriptionIndex);//任务的状态修改 // if (missionState == 0 && (MissionState == 1 || MissionState == 2)) // { // if (Event_TaskToAdd != null)//任务添加(用于存储于身上的未接取任务的特殊处理) // { // Event_TaskToAdd(MissionID, MissionState, DiscriptionIndex); // } // } // else // { // if (Event_TaskRefreshes != null)//刷新任务 // { // Event_TaskRefreshes(MissionID); // } // } // if (lastDescriptionIndex != DiscriptionIndex) // { // if (taskDescriptionRefresh != null) // { // taskDescriptionRefresh(MissionID); // } // } // } // else // { // AddMission(MissionID, MissionState, DiscriptionIndex);//任务的添加 // if (taskDescriptionRefresh != null) // { // taskDescriptionRefresh(MissionID); // } // if (Event_TaskToAdd != null) // { // Event_TaskToAdd(MissionID, MissionState, DiscriptionIndex); // } // } // TaskClassification(MissionID, MissionState);//任务分类 // IsShowNpC(1);//是否显示NPC // IsShowNpC(MissionID);//是否显示NPC // if (isServerPrepare) // { // AutotaskingPrecedence(isServerPrepare, MissionID);//是否执行自动任务 // } // TaskTerminationToHangUp(MissionID, MissionState);//结束赏金和仙盟任务前往挂机 // if (Event_TaskResponse != null)//发送任务灯信息 // { // if (allMissionDict[MissionID].LightList.Equals(default(TsakLight))) // { // return; // } // for (int i = 0; i < allMissionDict[MissionID].LightList.Count; i++) // { // Event_TaskResponse(allMissionDict[MissionID].LightList[i].NpcId, allMissionDict[MissionID].LightList[i].StateLight); // } // } // } // catch (Exception ex) // { // Debug.Log(ex.StackTrace); // } } // public ImpactRankModel.RankAwardItem GetRunTaskRward()//添加任务奖励 // { // var runTaskAward = FuncConfigConfig.Get("RunTaskAward"); // ImpactRankModel.RankAwardItem _award = new ImpactRankModel.RankAwardItem(); // var _jsonData = LitJson.JsonMapper.ToObject(runTaskAward.Numerical3); // var jsonData2 = LitJson.JsonMapper.ToObject(runTaskAward.Numerical4); // foreach (string key in _jsonData.Keys) // { // var _job = int.Parse(key); // var _itemArray = LitJson.JsonMapper.ToObject<int[][]>(_jsonData[key].ToJson()); // for (int j = 0; j < _itemArray.Length; j++) // { // _award.Add(_job, new Item(_itemArray[j][0], _itemArray[j][1])); // } // } // foreach (string key in jsonData2.Keys) // { // var _job = int.Parse(key); // _award.Add(_job, new Item(2301, 0)); // } // return _award; // } public int GetLatestMainTaskId() { var taskId = 0; //主线任务的顺序由任务列表的顺序决定 TaskListConfig.GetMissionIndex //这里是bug,但是因为只有一个主线任务,所以暂时不影响 foreach (var id in MainTaskDic.Keys) { if (id > taskId) { taskId = id; } } return taskId; } public bool TryGetTaskData(int _taskId, out MissionDetailDates taskData) { return allMissionDict.TryGetValue(_taskId, out taskData); } void DefaultDialogue()//关于打开默认对话界面 { // if (NewBieCenter.Instance.inGuiding || ModelCenter.Instance.GetModel<TreasureModel>().newGotShowing) // { // return; // } // bool IsOpenMain = UIManager.Instance.IsOpened<MainWin>(); // if (!UIManager.Instance.IsOpened<DefaultDialogueBoxWin>() && IsOpenMain) // { // UIManager.Instance.OpenWindow<DefaultDialogueBoxWin>(); // UIManager.Instance.CloseWindow<MainInterfaceWin>(); // } // else // { // if (talkNpcIdUpdate != null) // { // talkNpcIdUpdate(NPCid); // } // } } private void OnEventTalkEvent(int taskID)//NPC对话后的弹框 { //if (UIManager.Instance.ExitAnyFullScreenOrMaskWin()) //{ // return; //} //bug: 功能开启引导时,未收到服务端的封包快速对话会导致功能开启引导被打断,如果只是判断inGuiding又导致无法继续任务 //解决方案:1. 对话时判断有引导且必须界面在打开状态;2. 功能引导飞入的时候如果中断则取消引导 // -------------------------TODO YYL----------------------------------- // if ((NewBieCenter.Instance.inGuiding && UIManager.Instance.IsOpened<NewBieWin>()) || ModelCenter.Instance.GetModel<TreasureModel>().newGotShowing // || UIManager.Instance.IsOpened<TreasureChapterWin>()) // { // return; // } // bool IsOpenMain = UIManager.Instance.IsOpened<MainInterfaceWin>(); // var state = 0; // if (TryGetCustomTaskState(taskID, out state)) // { // var config = StoryMissionsConfig.GetConfig(taskID, state); // if (config != null && NPCid == config.NpcID) // { // if (!UIManager.Instance.IsOpened<DialogueDuidanceWin>() && IsOpenMain // && !UIManager.Instance.ExistAnyFullScreenOrMaskWin()) // { // UIManager.Instance.CloseWindow<MainInterfaceWin>(); // DialogueDuidanceWin.storyMissionId = config.id; // DialogueDuidanceWin.taskId = taskID; // UIManager.Instance.OpenWindow<DialogueDuidanceWin>(); // } // return; // } // } // if (!UIManager.Instance.IsOpened<TaskBoxBGMWin>() && IsOpenMain) // { // UIManager.Instance.CloseWindow<MainInterfaceWin>(); // UIManager.Instance.OpenWindow<TaskBoxBGMWin>(); // return; // } // if (BountyDic.ContainsKey(_TaskNow) || FairyAuDic.ContainsKey(_TaskNow)) // { // if (!ModelCenter.Instance.GetModel<TeamModel>().teamPrepare.isPreparing) // { // RequestGetTaskAward("OK", _TaskNow); // } // } } private void BountySelfMotion() { int blank = PackManager.Instance.GetEmptyGridCount(PackType.Item); if (blank < 1)//"请先清理背包再领取奖励 { return; } } public bool TryGetCustomTaskState(int taskId, out int state) { state = 0; if (ReplaceDic.ContainsKey(taskId)) { var keyValue = ReplaceDic[taskId]; if (keyValue.ContainsKey("state")) { state = keyValue["state"]; return true; } } return false; } void AddMission(int MissionID, int MissionState, int DiscriptionIndex)//添加任务 { // TODO YYL // var config = PyTaskConfig.Get(MissionID); // if (config == null) // { // Debug.LogError(MissionID + "表格中不存在此任务ID"); // return; // } // if (allMissionDict == null) // allMissionDict = new Dictionary<int, MissionDetailDates>(); // MissionDetailDates vDetailData = new MissionDetailDates(); // vDetailData.Time = DateTime.Now; // vDetailData.ID = int.Parse(config.id); // vDetailData.Name = config.name; // vDetailData.Type = config.type; // vDetailData.NPC_ID = config.npcId; // vDetailData.LV = config.lv; // vDetailData.ColorLV = config.colorLV; // vDetailData.RewardList = RewardInformation(config.rewardList, DiscriptionIndex);//奖励信息 // if (ReplaceDic.ContainsKey(MissionID)) // { // Dictionary<string, int> _dic = ReplaceDic[MissionID]; // if (_dic.ContainsKey("visit_npc_id") || _dic.ContainsKey("kill_npc_id")) // { // vDetailData.LightList = CharactersReplace(config.lightList, DiscriptionIndex, int.Parse(config.id)); // } // else // { // vDetailData.LightList = StrSegmentation(config.lightList, DiscriptionIndex);//任务信息灯 // } // if (MissionState == 3) // { // for (int i = 0; i < vDetailData.LightList.Count; i++) // { // TsakLight TsakLight = new TsakLight(); // TsakLight.NpcId = vDetailData.LightList[i].NpcId; // TsakLight.StateLight = -1; // vDetailData.LightList[i] = TsakLight; // } // } // } // else // { // vDetailData.LightList = StrSegmentation(config.lightList, DiscriptionIndex);//任务信息灯 // if (MissionState == 3) // { // for (int i = 0; i < vDetailData.LightList.Count; i++) // { // TsakLight TsakLight = new TsakLight(); // TsakLight.NpcId = vDetailData.LightList[i].NpcId; // TsakLight.StateLight = -1; // vDetailData.LightList[i] = TsakLight; // } // } // } // vDetailData.Desclist = TaskDetails(config.descList, DiscriptionIndex);//任务详情 // vDetailData.InforList = StrInforList(config.infoList, DiscriptionIndex);//任务完成条件 // vDetailData.MissionState = MissionState; // vDetailData.descIndex = DiscriptionIndex; // var canSwitchSelectTask = true; // if (GetNowTaskID != 0 && !IsMainTaskType(vDetailData.Type)) // { // MissionDetailDates taskData; // if (TryGetTaskData(GetNowTaskID, out taskData) // && IsMainTaskType(taskData.Type) // && taskData.MissionState != 3) // { // canSwitchSelectTask = false; // } // } // if (isServerPrepare && PriorityTaskChainContains(MissionID)) // { // canSwitchSelectTask = true; // } // if (canSwitchSelectTask) // { // GetNowTaskID = MissionID; // } // allMissionDict.Add(MissionID, vDetailData);//添加任务 } public bool PriorityTaskChainContains(int taskId) { for (int i = 0; i < priorityTaskChains.Count; i++) { if (taskId >= priorityTaskChains[i][0] && taskId <= priorityTaskChains[i][1]) { return true; } } return false; } public bool IsMainTaskType(int type) { return type == (int)TaskTypenum.MainlineTaskType || type == (int)TaskTypenum.MainlineTaskTyp2; } public enum TaskTypenum//任务类型分类 { MainlineTaskType = 0,//主线 MainlineTaskTyp2 = 1, SideQuestsType2 = 2,//支线 SideQuestsType3 = 3,//支线任务(本源法宝支线) SideQuestsType4 = 4, SideQuestsType5 = 5, BountyMissionsType6 = 6,//赏金任务 BountyMissionsType7 = 7, BountyMissionsType8 = 8, FairyAuMissionType11 = 11,//仙盟任务 FairyAuMissionType12 = 12, SpecialTaskType13 = 13,//特殊任务类型(用于赏金) SpecialTaskType14 = 14,//特殊任务类型(用于仙盟) AchievementTask = 15,//成就任务(暂未开出专属字典) SpecialTaskType16 = 16,//特殊任务类型(用于法宝) SideQuestsType17 = 17,//支线17-21新增 SideQuestsType18 = 18, SideQuestsType19 = 19, SideQuestsType20 = 20,//(后端特殊处理,暂定不让使用) SideQuestsType21 = 21, //后续IL开发添加预设 default1, default2, default3, default4, default5, default6, default7, default8, default9, default10, } void TaskClassification(int _taskID, int MissionState)//任务分类(主线任务,支线任务) { if (!allMissionDict.ContainsKey(_taskID)) { return; } TaskTypenum type = (TaskTypenum)allMissionDict[_taskID].Type; switch (type) { case TaskTypenum.MainlineTaskType: case TaskTypenum.MainlineTaskTyp2: { if (_taskID != 1)//主线任务(添加与更新) { if (MainTaskDic.ContainsKey(_taskID)) { MainTaskDic[_taskID] = allMissionDict[_taskID]; } else { MainTaskDic.Add(_taskID, allMissionDict[_taskID]); } if (Event_MainlineTask != null) { Event_MainlineTask(_taskID, MissionState); } } } break; case TaskTypenum.SideQuestsType2: case TaskTypenum.SideQuestsType3: case TaskTypenum.SideQuestsType4: case TaskTypenum.SideQuestsType5: case TaskTypenum.SideQuestsType17: case TaskTypenum.SideQuestsType18: case TaskTypenum.SideQuestsType19: case TaskTypenum.SideQuestsType20: case TaskTypenum.SideQuestsType21: { if (SideQuestsDic.ContainsKey(_taskID)) { SideQuestsDic[_taskID] = allMissionDict[_taskID]; } else { SideQuestsDic.Add(_taskID, allMissionDict[_taskID]); } if (SideQuestChangeEvent != null) { SideQuestChangeEvent(_taskID); } } break; case TaskTypenum.BountyMissionsType6: case TaskTypenum.BountyMissionsType7: case TaskTypenum.BountyMissionsType8: { if (BountyDic.ContainsKey(_taskID)) BountyDic[_taskID] = allMissionDict[_taskID]; else BountyDic.Add(_taskID, allMissionDict[_taskID]); if (Event_nBounty != null) Event_nBounty(); } break; case TaskTypenum.FairyAuMissionType11: case TaskTypenum.FairyAuMissionType12: { if (FairyAuDic.ContainsKey(_taskID)) FairyAuDic[_taskID] = allMissionDict[_taskID]; else FairyAuDic.Add(_taskID, allMissionDict[_taskID]); if (Event_FairyAuTask != null && MissionState != 3) Event_FairyAuTask(); } break; case TaskTypenum.SpecialTaskType13: case TaskTypenum.SpecialTaskType14: case TaskTypenum.SpecialTaskType16: { if (SpecialTask.ContainsKey(_taskID)) SpecialTask[_taskID] = allMissionDict[_taskID]; else SpecialTask.Add(_taskID, allMissionDict[_taskID]); } break; default: break; } } void TaskTypeDeletion(int _taskID)//任务类型的删除 { if (MainTaskDic.ContainsKey(_taskID))//主线 { MainTaskDic.Remove(_taskID); } else if (SideQuestsDic.ContainsKey(_taskID))//支线 { SideQuestsDic.Remove(_taskID); } else if (BountyDic.ContainsKey(_taskID))//赏金 { BountyDic.Remove(_taskID); if (Event_nBounty != null) Event_nBounty(); } else if (SpecialTask.ContainsKey(_taskID))//特殊任务 { SpecialTask.Remove(_taskID); } else if (FairyAuDic.ContainsKey(_taskID)) { FairyAuDic.Remove(_taskID); if (Event_FairyAuTask != null) Event_FairyAuTask(); } } string TaskDetails(string _string, int _index)////Json解析 { JsonData _Json = JsonMapper.ToObject(_string); if (_Json.Count == 1) { string _TaskDetails = _Json["0"].ToString().Replace("\"", ""); return _TaskDetails; } else { string _TaskDetails = _Json[_index.ToString()].ToString().Replace("\"", ""); return _TaskDetails; } } List<TsakLight> CharactersReplace(string _string, int _index, int Id) { JsonData _Json = JsonMapper.ToObject(_string); List<TsakLight> TsakLightList = new List<TsakLight>(); TsakLightList.Clear(); TsakLight taskLight = new TsakLight(); foreach (var key in _Json.Keys) { if (int.Parse(key) == _index) { JsonData _Json1 = _Json[key]; if (_Json1.Count != 0) { foreach (var _key in _Json1.Keys) { string Str = _key.ToString(); Match match = Regex.Match(Str, pattern); if (ReplaceDic.ContainsKey(Id)) { Dictionary<string, int> _dic = ReplaceDic[Id]; if (_dic.ContainsKey(match.Groups[1].Value)) { taskLight.NpcId = _dic[match.Groups[1].Value]; taskLight.StateLight = int.Parse(_Json1[_key].ToString()); TsakLightList.Add(taskLight); } } } } return TsakLightList; } } return TsakLightList; } string StrInforList(string _string, int _index) { JsonData _Json = JsonMapper.ToObject(_string); foreach (var key in _Json.Keys) { if (int.Parse(key) == _index) { JsonData _Json1 = _Json[key]; if (_Json1.Count != 0) { foreach (var _key in _Json1.Keys) { return _Json1[_key].ToString(); } } } } return string.Empty; } List<TsakLight> StrSegmentation(string _string, int _index) { int val; JsonData _Json = JsonMapper.ToObject(_string); List<TsakLight> TsakLightList = new List<TsakLight>(); TsakLightList.Clear(); foreach (var key in _Json.Keys) { if (int.Parse(key) == _index) { JsonData _Json1 = _Json[key]; if (_Json1.Count != 0) { foreach (var _key in _Json1.Keys) { if (int.TryParse(_key, out val)) { TsakLight taskLight = new TsakLight(); taskLight.NpcId = int.Parse(_key); taskLight.StateLight = int.Parse(_Json1[_key].ToString()); TsakLightList.Add(taskLight); } } } return TsakLightList; } } return TsakLightList; } string RewardInformation(string _string, int _index)//奖励信息 { string _occupation = ("J" + PlayerDatas.Instance.baseData.Job).ToString(); JsonData _Json = JsonMapper.ToObject(_string); foreach (var key in _Json.Keys) { if (int.Parse(key) == _index) { JsonData _Json1 = _Json[key]; if (_Json1.Count != 0) { foreach (var _key in _Json1.Keys) { if (_key == _occupation) return _Json1[_key].ToString(); else if (_key == "-") return _Json1[_key].ToString(); } } else { return null; } } } return null; } void TaskChanges(int MissionID, int MissionState, int DiscriptionIndex)//存在的任务的修改 { // TODO YYL // var pytaskM = PyTaskConfig.Get(MissionID); // if (pytaskM == null) // return; // allMissionDict[MissionID].Time = DateTime.Now; // allMissionDict[MissionID].MissionState = MissionState; // allMissionDict[MissionID].descIndex = DiscriptionIndex; // allMissionDict[MissionID].RewardList = RewardInformation(pytaskM.rewardList, DiscriptionIndex);//奖励信息 // allMissionDict[MissionID].Desclist = TaskDetails(pytaskM.descList, DiscriptionIndex);//任务详情 // allMissionDict[MissionID].InforList = StrInforList(pytaskM.infoList, DiscriptionIndex);//任务完成条件 // if (MissionState == 3) // { // if (allMissionDict[MissionID].LightList.Equals(default(TsakLight))) // { // return; // } // for (int i = 0; i < allMissionDict[MissionID].LightList.Count; i++) // { // TsakLight TsakLight = new TsakLight(); // TsakLight.NpcId = allMissionDict[MissionID].LightList[i].NpcId; // TsakLight.StateLight = -1; // allMissionDict[MissionID].LightList[i] = TsakLight; // } // return; // } // else // { // if (ReplaceDic.ContainsKey(MissionID)) // { // Dictionary<string, int> _dic = ReplaceDic[MissionID]; // if (_dic.ContainsKey("visit_npc_id") || _dic.ContainsKey("kill_npc_id")) // { // allMissionDict[MissionID].LightList = CharactersReplace(pytaskM.lightList, DiscriptionIndex, allMissionDict[MissionID].ID); // } // else // { // allMissionDict[MissionID].LightList = StrSegmentation(pytaskM.lightList, DiscriptionIndex);//任务信息灯 // } // } // else // { // allMissionDict[MissionID].LightList = StrSegmentation(pytaskM.lightList, DiscriptionIndex);//任务信息灯 // } // } } public void Task0820(H0820_tagMissionDict info)//0820信息字典 { // TODO YYL // Dictionary<string, int> dic = null; // ReplaceDic.TryGetValue((int)info.MissionID, out dic); // if (dic == null) // { // dic = new Dictionary<string, int>(); // StorageNPCDic(info.MissionID, info.DictKey, (int)info.DictValue); // dic.Add(info.DictKey, (int)info.DictValue); // ReplaceDic.Add((int)info.MissionID, dic); // } // else // { // if (dic.ContainsKey(info.DictKey)) // { // StorageNPCDic(info.MissionID, info.DictKey, (int)info.DictValue); // dic[info.DictKey] = (int)info.DictValue; // if (info.DictKey == "around_allcount") // { // if (TaskCoinTaskEvent != null) // { // TaskCoinTaskEvent(); // } // } // if (info.DictKey == "around_count_family") // { // if (FairyTaskEvent != null) // { // FairyTaskEvent(); // } // } // } // else // { // StorageNPCDic(info.MissionID, info.DictKey, (int)info.DictValue); // dic.Add(info.DictKey, (int)info.DictValue); // } // } } public void RequestGetTaskAward(string _answer, int taskId = 0) { // TODO YYL // if (taskId == clientGuardDugeonTask) // { // ClientGuardDungeon.RequestEnter(); // return; // } // var sendInfo = new C0802_tagCNPCAnswer(); // sendInfo.Answer = _answer; // sendInfo.AnswerLen = (byte)_answer.Length; // GameNetSystem.Instance.SendInfo(sendInfo); // if (tryGetTaskAwardEvent != null) // { // tryGetTaskAwardEvent(); // } } public void TaskRefreshes(int _MissionId, int _DictKeyLen, string _DictKey, int _DictValue)//任务数据的刷新(任务字典信息) { if (!_DicTaskInformation.ContainsKey(_MissionId)) { Dictionary<string, string> _dic = new Dictionary<string, string>(); if (_dic.ContainsKey(_DictKey)) { _dic[_DictKey] = _DictValue.ToString(); } else { _dic.Add(_DictKey, _DictValue.ToString()); } _DicTaskInformation.Add(_MissionId, _dic); string kaji = "kaji"; if (_DicTaskInformation.ContainsKey(_MissionId) && _DicTaskInformation[_MissionId].ContainsKey(kaji)) { if (MainTaskDic.ContainsKey(_MissionId) && MainCardLevelChange != null && _DictValue == 0) { if (IsGetOnBool) { GetNowTaskID = _MissionId; } MainCardLevelChange(_MissionId); } } } else { if (_DicTaskInformation[_MissionId].ContainsKey(_DictKey)) { _DicTaskInformation[_MissionId][_DictKey] = _DictValue.ToString(); if (_DictKey == "kaji" && (_DictValue == 0 || _DictValue == 1))//kaji:0为主线卡级变更,kaji:1为魔族卡级变更 { if (CardLevelChange != null) { CardLevelChange(_MissionId); } if (MainTaskDic.ContainsKey(_MissionId)) { if (IsGetOnBool) { GetNowTaskID = _MissionId; } if (MainCardLevelChange != null) { MainCardLevelChange(_MissionId); } } } } else { _DicTaskInformation[_MissionId].Add(_DictKey, _DictValue.ToString()); } } if (Event_TaskInformation != null) Event_TaskInformation(_MissionId, _DicTaskInformation); } public void DelMission(int _taskID)//真实任务删除 { if (allMissionDict.ContainsKey(_taskID)) { allMissionDict.Remove(_taskID); if (_DicTaskInformation.ContainsKey(_taskID)) { _DicTaskInformation.Remove(_taskID); } } TaskTypeDeletion(_taskID); if (Event_TaskToDelete != null) { Event_TaskToDelete(_taskID); } } bool _bool = false; string _conversationA = null; public void EventTalk(H0801_tagEventTalk info)//访问任务是否可提交 { NPCid = (int)info.NPCID; if (info.Msg == null || info.Msg[0].MsgLen == 0) { _conversation = _conversationA; } else { if (_conversationA != info.Msg[0].Msg) { _conversation = info.Msg[0].Msg; _conversationA = _conversation; } } if (_bool) { if ((int)info.MissionID != 0) { _TaskNow = (int)info.MissionID; OnEventTalkEvent((int)info.MissionID); _bool = false; return; } } for (int i = 0; i < info.Answer.Length; i++) { string[] str = info.Answer[i].Msg.Split('_'); int var; if (str.Length > 1) { for (int j = 0; j < info.Answer.Length; j++) { string[] stX = info.Answer[j].Msg.Split('_'); if (stX.Length > 1) { string strXX = stX[stX.Length - 1]; if (int.TryParse(strXX, out var)) { if (int.Parse(strXX) == GetNowTaskID) { RequestGetTaskAward(strXX); _bool = true; return; } } } } string str1 = str[str.Length - 1]; RequestGetTaskAward(str1); _bool = true; return; } else { _bool = false; if ((int)info.NPCID != 32504001) { DefaultDialogue(); } return; } } } public string pattern = @"\{(.+)\}"; public int StatusLightQuery(int _NpcID)//状态灯查询 { int Light = -1; foreach (int key in allMissionDict.Keys) { if (allMissionDict[key].LightList.Equals(default(TsakLight))) { continue; } for (int i = 0; i < allMissionDict[key].LightList.Count; i++) { if (_NpcID == allMissionDict[key].LightList[i].NpcId) { if (allMissionDict[key].LightList[i].StateLight > Light) { Light = allMissionDict[key].LightList[i].StateLight; } } } } return Light; } public void DailyFairyTaskMove()//日常仙盟任务 { // TODO YYL // if (SpecialTask.Count != 0) // { // foreach (int key in SpecialTask.Keys) // { // if (SpecialTask[key].Type == 14 && SpecialTask[key].MissionState != 3)//未接任务 // { // PlayerDatas.Instance.hero.Behaviour.StopHandupAI(); // SnxxzGame.Instance.StartCoroutine(WaitForSkillFinished(key)); // return; // } // } // } // if (FairyAuDic.Count != 0) // { // foreach (int key in FairyAuDic.Keys) // { // if (FairyAuDic[key].MissionState != 0 && FairyAuDic[key].MissionState != 3) // { // PlayerDatas.Instance.hero.Behaviour.StopHandupAI(); // SnxxzGame.Instance.StartCoroutine(WaitForSkillFinished(key)); // return; // } // } // } } public void DailyBountyMove()//日常赏金任务 { // if (SpecialTask.Count != 0) // { // foreach (int key in SpecialTask.Keys) // { // if (SpecialTask[key].Type == 13 && SpecialTask[key].MissionState != 3)//未接任务 // { // PlayerDatas.Instance.hero.Behaviour.StopHandupAI(); // SnxxzGame.Instance.StartCoroutine(WaitForSkillFinished(key)); // return; // } // } // } // if (BountyDic.Count != 0) // { // foreach (int key in BountyDic.Keys) // { // if (BountyDic[key].MissionState != 0 && BountyDic[key].MissionState != 3) // { // PlayerDatas.Instance.hero.Behaviour.StopHandupAI(); // SnxxzGame.Instance.StartCoroutine(WaitForSkillFinished(key)); // return; // } // } // } } private void AutotaskingPrecedence(bool automaticityBool, int missionID)//关于是否执行自动任务和自动任务的优先级 { if (automaticityBool) { var inDungeon = IsDungeon(); if (inDungeon)//判断是否再副本中对任务ID进行储存 { retainTaskID = Autotasking(missionID); } else { retainTaskID = 0; if (Autotasking(missionID) != 0) { AutomaticTripToTask(Autotasking(missionID)); } } } } private int Autotasking(int taskID) { foreach (var value in MainTaskDic.Values) { if (value.MissionState != 0 && value.MissionState != 3) { if (allMissionDict.ContainsKey(taskID) && (allMissionDict[taskID].Time - value.Time).TotalSeconds <= 1) { if (ReplaceDic.ContainsKey(value.ID)) { Dictionary<string, int> _dic = ReplaceDic[value.ID]; if (_dic.ContainsKey("continue") && _dic["continue"] == 1) { return value.ID; } } } } } if (ReplaceDic.ContainsKey(taskID)) { Dictionary<string, int> _dic = ReplaceDic[taskID]; if (_dic.ContainsKey("continue") && _dic["continue"] == 1) { return taskID; } } return 0; } public void AutomaticTripToTask(int _taskID)//任务自动前往(任务添加) { // TODO YYL // try // { // if (!allowAutoTaskMapIds.Contains(PlayerDatas.Instance.baseData.MapID)) // { // return; // } // var _hero = PlayerDatas.Instance.hero; // if (_hero != null) // { // if (MapArea.IsInMapArea(_hero.CurMapArea, MapArea.E_Type.Boss)) // { // return; // } // } // if (MainTaskDic.ContainsKey(_taskID))//主线任务 // { // if (MainTaskDic[_taskID].MissionState == 0 || MainTaskDic[_taskID].MissionState == 3) // return; // if (MainTaskDic.ContainsKey(_taskID)) // { // PlayerDatas.Instance.hero.Behaviour.StopHandupAI(); // if (PlayerDatas.Instance.baseData.LV != 1) // SnxxzGame.Instance.StartCoroutine(WaitForSkillFinished(_taskID)); // return; // } // } // if (BountyDic.ContainsKey(_taskID))//赏金任务 // { // if (BountyDic[_taskID].MissionState == 3 || BountyMotionBool) // { // return; // } // else // { // if (BountyDic.ContainsKey(_taskID)) // { // PlayerDatas.Instance.hero.Behaviour.StopHandupAI(); // SnxxzGame.Instance.StartCoroutine(WaitForSkillFinished(_taskID)); // return; // } // } // } // else if (FairyAuDic.ContainsKey(_taskID))//仙盟任务 // { // if (FairyAuDic[_taskID].MissionState == 3 || FairyAuBool) // { // return; // } // if (FairyAuDic.ContainsKey(_taskID)) // { // PlayerDatas.Instance.hero.Behaviour.StopHandupAI(); // SnxxzGame.Instance.StartCoroutine(WaitForSkillFinished(_taskID)); // return; // } // } // else if (SideQuestsDic.ContainsKey(_taskID)) // { // if (SideQuestsDic[_taskID].MissionState == 0 || SideQuestsDic[_taskID].MissionState == 3) // { // return; // } // else // { // PlayerDatas.Instance.hero.Behaviour.StopHandupAI(); // SnxxzGame.Instance.StartCoroutine(WaitForSkillFinished(_taskID)); // return; // } // } // } // catch (Exception ex) // { // Debug.Log(ex); // } } public void RunTaskAwarInfo(HA708_tagMCRunTaskAwardInfo info)//通知跑环奖励记录 { for (int i = 0; i < info.Cnt; i++) { if (!AwardRecordDic.ContainsKey(info.InfoList[i].Type)) { RunTaskAwardRecord _RunTaskAwardRecord = new RunTaskAwardRecord(); _RunTaskAwardRecord.Num = (int)info.InfoList[i].Num; _RunTaskAwardRecord.AwardState = info.InfoList[i].AwardState; AwardRecordDic.Add(info.InfoList[i].Type, _RunTaskAwardRecord); } else { AwardRecordDic[info.InfoList[i].Type].Num = (int)info.InfoList[i].Num; AwardRecordDic[info.InfoList[i].Type].AwardState = info.InfoList[i].AwardState; } if (info.InfoList[i].Type == (int)TaskTypenum.BountyMissionsType7) { BountyRewardsNumber = (int)info.InfoList[i].Num; if (Event_BountyRewards != null) Event_BountyRewards((int)info.InfoList[i].Num, info.InfoList[i].AwardState); } else if (info.InfoList[i].Type == (int)TaskTypenum.FairyAuMissionType12) { OnFairyAuNumber = (int)info.InfoList[i].Num; if (Event_FairyAuReward != null) Event_FairyAuReward((int)info.InfoList[i].Num, info.InfoList[i].AwardState); } } } // private IEnumerator WaitForSkillFinished(int _taskID) // { // GA_Hero _hero = PlayerDatas.Instance.hero; // if (_hero == null) // { // yield break; // } // while (_hero != null && _hero.SkillMgr.CurCastSkill != null && // _hero.SkillMgr.CurCastSkill.SkillCompelete == false) // { // yield return null; // } // yield return WaitingForSecondConst.WaitMS500; // // 如果有守护, 则不拾取 // var equipIndex = EquipSet.ClientPlaceToServerPlace(new Int2(0, (int)RoleEquipType.Guard)); // var _itemModel = PackManager.Instance.GetItemByIndex(PackType.Equip, equipIndex); // if (_itemModel == null || !GeneralDefine.GuardianPickUpID.Contains(_itemModel.itemId)) // { // float _chkDistanceSqrt; // DropItemManager.DropObject _obj = null; // while (DropItemManager.HandupTryGetHeroItem(out _obj)) // { // if (DropItemManager.StopMissionPickup) // { // break; // } // if (MapTransferUtility.Instance.MapTransferDoType != MapTransferUtility.E_MapTransferDoType.None) // { // break; // } // Vector3 _targetPosition = _obj.dropItem.transform.position; // _chkDistanceSqrt = MathUtility.DistanceSqrtXZ(_hero.Pos, _targetPosition); // if (_chkDistanceSqrt > 0.5f) // { // if (_hero.State != E_ActorState.AutoRun) // { // _hero.MoveToPosition(_targetPosition); // } // } // yield return null; // } // } // if (AdventureStage.Instance.IsInAdventureStage) // { // yield break; // } // if (NewBieCenter.Instance.inGuiding || ModelCenter.Instance.GetModel<TreasureModel>().newGotShowing // || UIManager.Instance.IsOpened<TreasureChapterWin>()) // { // yield break; // } // if (UIManager.Instance.IsOpened<TreasureBaseWin>()) // { // yield break; // } // if (UIManager.Instance.IsOpened<MysteriousMissionWin>()) // { // yield break; // } // if (CrossServerUtility.IsCrossServer()) // { // yield break; // } // if (BossShowModel.Instance.BossShowing) // { // yield break; // } // if (BountyDic.ContainsKey(_taskID) || FairyAuDic.ContainsKey(_taskID)) // { // yield return WaitingForSecondConst.WaitMS800;//缓冲一秒再进行 // } // if (MainTaskDic.ContainsKey(_taskID))//主线等待表现 // { // if (taskWait.wait) // { // yield return WaitingForSecondConst.GetWaitForSeconds(mainTaskAutoWaitTime); // } // } // while(ClientSceneManager.Instance.isWaitPickup) // { // yield return null; // } // if (GA_Hero.s_MapSwitching) // { // yield break; // } // try // { // TaskMove(_taskID); // } // catch (Exception ex) // { // Debug.Log(ex); // } // } public enum TaskStatus//任务状态 { None = -5,//没有 Normal = 0,//正常任务(绿) TreasureCardLevel = 1,//法宝卡级(红) CardLevel = 2,//等级卡级(红) Completed = 3,//立即完成任务 } public TaskStatus GetTaskStatus(int taskID) { if (_DicTaskInformation.ContainsKey(taskID) && _DicTaskInformation[taskID].ContainsKey("kaji")) { var kaji = _DicTaskInformation[taskID]["kaji"]; switch (int.Parse(kaji)) { case 0: return TaskStatus.Normal; case 1: return TaskStatus.TreasureCardLevel; case 2: return TaskStatus.CardLevel; case 3: return TaskStatus.Completed; default: return TaskStatus.None; } } else { return TaskStatus.None; } } private bool IsDungeon()//判断是否在副本中 { return false; // if (ClientDungeonStageUtility.isClientDungeon) // return true; // var mapId = PlayerDatas.Instance.baseData.MapID; // var mapConfig = MapConfig.Get(mapId); // return mapConfig != null && mapConfig.MapFBType != 0; } public bool IsGather(int npdId)//是否能采集NPC { // TODO YYL // var taskListConfig = TaskListConfig.Get(currentMission); // if (taskListConfig != null) // { // int[] collectNPCList = taskListConfig.CollectNPC; // var isTaskNPC = false; // for (int i = 0; i < collectNPCList.Length; i++) // { // if (collectNPCList[i] == npdId) // { // isTaskNPC = true; // break; // } // } // if (isTaskNPC) // { // if ((collectNPCList.Length == 1 && collectNPCList[0] == 0) || GetTaskStatus(currentMission) != 0) // { // return false; // } // } // } return true; } public static bool IsOPenAutoResolve()//任务面板不开启自动挂机状态 { bool _bool = true; // TODO YYL // if (UIManager.Instance.IsOpened<TaskBoxBGMWin>()) // { // _bool = false; // } // else if (UIManager.Instance.IsOpened<DefaultDialogueBoxWin>()) // { // _bool = false; // } // else if (UIManager.Instance.IsOpened<DialogueDuidanceWin>()) // { // _bool = false; // } return _bool; } private int BOUNTYTASK = 2009;//赏金任务 private int FAIRYAUTASK = 3009;//仙盟任务 private void TaskTerminationToHangUp(int taskID, int MissionState)//(完成任务后前往挂机地点)任务ID,任务状态 { // TODO YYL // if (!isServerPrepare) // { // return; // } // if ((taskID == BOUNTYTASK && MissionState == 1 && !BountyMotionBool && TaskAllocation.Instance.ForRingAllNumber() != 10) // || (taskID == FAIRYAUTASK && MissionState == 1 && !FairyAuBool && TaskAllocation.Instance.FairyAuAllNumber() == 70)) // { // var mapModel = ModelCenter.Instance.GetModel<MapModel>(); // var point = mapModel.GetRecommendHangPoint(); // var config = MapEventPointConfig.Get(point); // MapTransferUtility.Instance.MoveToNPC(config.NPCID); // } } public void CompletionOfTask(int TaskID)//任务完成 { CA206_tagCMQuickFinishMission _CA206 = new CA206_tagCMQuickFinishMission(); _CA206.MissionID = (uint)TaskID; _CA206.DoType = 0; GameNetSystem.Instance.SendInfo(_CA206); } public int SideQuestState(int TaskID)//关于查询任务的状态(-1没有此任务,0未接,1正在进行中,2可提交) { if (allMissionDict.ContainsKey(TaskID)) { return allMissionDict[TaskID].MissionState; } else { return -1; } } public int GetQuestState(int _taskId) { if (allMissionDict.ContainsKey(_taskId)) { return allMissionDict[_taskId].MissionState; } else { return -1; } } //--------主要用于记录任务列表选中条的智能性 (-_-||) public int TaskupToDate = 0;//获取最新任务ID public int GetOnTaskId = 0; public bool IsGetOnBool = false; private int NeedTime = 10; private DateTime dateTimeA; public void GetTaskGetOnNow(int TaskID, string DictKey)//记录下信息字典的ID { string key1Str = "on_kill_" + TaskID; string key2Str = "get_byid_" + TaskID; if (TaskID > 1 && (key1Str == DictKey || key2Str == DictKey)) { GetOnTaskId = TaskID; dateTimeA = DateTime.Now; } } private void secondEvent() { TimeSpan timeS = DateTime.Now - dateTimeA; int timeSend = timeS.Seconds; if (timeSend >= NeedTime) { IsGetOnBool = true; GetOnTaskId = GetNowTaskID;//获取当前选中的ID } else { IsGetOnBool = false; } if (TaskOverBool) { Times += 1; if (Times >= NeedTime) { TaskOverBool = false; } } else { if (Times != 0) { Times = 0; } } } public bool IsTaskMove() { bool IsBool = false; if (!UIManager.Instance.IsOpened<MainWin>()) { return IsBool; } if (PlayerDatas.Instance.baseData.LV > TaskAutoLv) { return IsBool; } if (GetTaskStatus(currentMission) == TaskStatus.Normal) { IsBool = true; } return IsBool; } public void TaskMove(int _taskID) { // TODO YYL // if (allMissionDict.ContainsKey(_taskID) && !NewBieCenter.Instance.inGuiding) // { // string _strTest = allMissionDict[_taskID].InforList; // string strTask = TaskAllocation.Instance.GetTaskInfo(TASKINFOConfig.Get(_strTest).show_writing, _taskID); // HrefAnalysis.Inst.ExcuteHrefEvent(strTask, 0, true); // DropItemManager.StopMissionPickup = false; // TaskAllocation.Instance.TaskTime = TimeUtility.ServerNow; // } } public class TaskWait { public bool wait { get { foreach (var key in taskWaits.Keys) { if ((Time.realtimeSinceStartup - taskWaits[key]) < 1f) { #if UNITY_EDITOR Debug.LogFormat("<color=#00ffff>由于{0}开始任务等待</color>", GetTaskWaitTypeLabel(key)); #endif return true; } } return false; } } Dictionary<TaskWaitType, float> taskWaits = new Dictionary<TaskWaitType, float>(); public void Push(TaskWaitType type) { taskWaits[type] = Time.realtimeSinceStartup; } #if UNITY_EDITOR static string GetTaskWaitTypeLabel(TaskWaitType waitType) { switch (waitType) { case TaskWaitType.TaskComplete: return "主界面任务完成表现"; case TaskWaitType.LevelUp: return "玩家升级表现"; case TaskWaitType.TreasureProgress: return "法宝进度更新"; case TaskWaitType.BetterEquip: return "获得更好装备"; default: return waitType.ToString(); } } #endif } public enum TaskWaitType { TaskComplete, LevelUp, TreasureProgress, BetterEquip, } } Main/Manager/GameSystemManager/TaskManager.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 55e9f9f8961578d4c97fe23bbcc2585e MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/Manager/LoginManager.cs
@@ -93,7 +93,7 @@ // TODO YYL // OperationLogCollect.Instance.RecordLauchEvent(5); // GameNotice.OpenGameNotice(); GameNotice.OpenGameNotice(); } private void OnSDKAccountLoginOutOk() @@ -207,8 +207,7 @@ if (string.IsNullOrEmpty(_result)) { busy = false; // TODO YYL // ServerTipDetails.DisplayNormalTip(Language.Get("L1117")); ServerTipDetails.DisplayNormalTip(Language.Get("L1117")); NetLinkWin.Hide(); return; } @@ -218,8 +217,7 @@ { if (stringSet.Length > 1) { // TODO YYL // ServerTipDetails.DisplayNormalTip(stringSet[1]); ServerTipDetails.DisplayNormalTip(stringSet[1]); } busy = false; @@ -247,40 +245,36 @@ private void OnGameServerConnected(bool ok) { // TODO YYL // if (ok) // { // var sendInfo = new C0123_tagCClientPackVersion(); // sendInfo.Version = DwVersionNo; // GameNetSystem.Instance.SendInfo(sendInfo); // } // else // { // busy = false; // } if (ok) { var sendInfo = new C0123_tagCClientPackVersion(); sendInfo.Version = DwVersionNo; GameNetSystem.Instance.SendInfo(sendInfo); } else { busy = false; } } // TODO YYL public void AccessLogin(/*H0101_tagServerPrepared _serverInfo*/) public void AccessLogin(H0101_tagServerPrepared _serverInfo) { // GameNetSystem.Instance.SendInfo(Get0101SendPackage(_serverInfo)); // 登录 GameNetSystem.Instance.SendInfo(Get0101SendPackage(_serverInfo)); // 登录 } public void CheckClientVersion() { // TODO YYL // var sendInfo = new C010D_tagCClientVersion(); // sendInfo.Version = "10.1000.1"; // GameNetSystem.Instance.SendInfo(sendInfo); var sendInfo = new C010D_tagCClientVersion(); sendInfo.Version = "10.1000.1"; GameNetSystem.Instance.SendInfo(sendInfo); } private void OnApplicationOut() { // TODO YYL // var sendInfo = new C0103_tagCPlayerLogOut(); // sendInfo.Type = 1; // GameNetSystem.Instance.SendInfo(sendInfo); var sendInfo = new C0103_tagCPlayerLogOut(); sendInfo.Type = 1; GameNetSystem.Instance.SendInfo(sendInfo); } public void RequestServerListLoop() @@ -298,4 +292,92 @@ LastLoopSecond = nowTick; } } public C0101_tagCPlayerLogin Get0101SendPackage(H0101_tagServerPrepared _serverInfo) { var send = new C0101_tagCPlayerLogin(); switch (VersionConfig.Get().versionAuthority) { case VersionAuthority.InterTest: send.IDType = 1; send.AccID = accountBuf; if (sdkLoginResult == null) send.Password = "111"; else send.Password = sdkLoginResult.token; send.MAC = DeviceUtility.GetMac(); send.Version = _serverInfo.Version; send.LineNO = 255; send.AppID = VersionConfig.Get().appId; send.AccountID = 1000;// 内部登陆的时候的id send.TokenExpire = "1519750743000";// 内部登陆的时长,无所谓的 send.Phone = 0; send.ServerID = (uint)ServerListCenter.Instance.currentServer.region_flag; send.Adult = 1; send.ExtraLen = 0; send.Extra = ""; break; case VersionAuthority.Release: send.Extra = VersionConfig.Get().SpID + "|" + SDKUtils.Instance.Device.uniqueID; send.ExtraLen = (ushort)send.Extra.Length; if (SDKUtils.Instance.ChannelPlatform == SDKUtils.E_ChannelPlatform.Free) { send.IDType = 1; send.Password = sdkLoginResult.token; } else if (SDKUtils.Instance.ChannelPlatform == SDKUtils.E_ChannelPlatform.Quick) { send.IDType = 10; send.Extra += ("|" + sdkLoginResult.token + "|" + sdkLoginResult.qkUserName); send.ExtraLen = (ushort)send.Extra.Length; } else if (SDKUtils.Instance.ChannelPlatform == SDKUtils.E_ChannelPlatform.Hy || SDKUtils.Instance.ChannelPlatform == SDKUtils.E_ChannelPlatform.hygt || SDKUtils.Instance.ChannelPlatform == SDKUtils.E_ChannelPlatform.newyn || SDKUtils.Instance.ChannelPlatform == SDKUtils.E_ChannelPlatform.en ) { send.IDType = (byte)SDKUtils.Instance.ChannelPlatform; send.Extra += ("|" + sdkLoginResult.token + "|" + sdkLoginResult.qkUserName); send.ExtraLen = (ushort)send.Extra.Length; } send.AccID = sdkLoginResult.account; var deviceInfo = DeviceUtility.GetDeviceModel(); deviceInfo.Replace(" ", "").Replace("=", "").Replace("%", "").Replace("-", "").Replace("|",""); var versionStr = StringUtility.Contact(VersionConfig.Get().version, "_", VersionConfig.Get().buildIndex, "_", deviceInfo); send.Extra += ("|" + versionStr.Substring(0, Math.Min(24, versionStr.Length))); Debug.Log("=====> extra: " + send.Extra); send.ExtraLen = (ushort)send.Extra.Length; send.MAC = DeviceUtility.GetMac(); send.Version = _serverInfo.Version; send.LineNO = 255; send.AppID = VersionConfig.Get().appId; send.AccountID = (uint)sdkLoginResult.accountID; send.TokenExpire = sdkLoginResult.tokenExpire; if (SDKUtils.Instance.ChannelPlatform == SDKUtils.E_ChannelPlatform.Sp) { send.TokenExpire = SDKUtils.Instance.FreePlatformInfo.timeStamp; } send.Phone = (byte)sdkLoginResult.phone; send.ServerID = (uint)ServerListCenter.Instance.currentServer.region_flag; if (sdkIDCheckIDAuthentication.type == "1") { send.Adult = 1; } else if (sdkIDCheckIDAuthentication.type == "2") { send.Adult = MathUtility.CheckAdult(sdkIDCheckIDAuthentication.card_id) ? (byte)1 : (byte)0; } else { send.Adult = 0; } break; } return send; } } Main/NetworkPackage/ClientPack/ClientToGameServer/C01_System.meta
New file @@ -0,0 +1,8 @@ fileFormatVersion: 2 guid: 4f6fe0f13f389d143b4d666c60731be9 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: Main/NetworkPackage/ClientPack/ClientToGameServer/C01_System/C0101_tagCPlayerLogin.cs
New file @@ -0,0 +1,46 @@ using UnityEngine; using System.Collections; //01 01人物登录 #tagCPlayerLogin public class C0101_tagCPlayerLogin : GameNetPackBasic { public byte IDType; //账号类型.0:普通账号;1:FreeSDK; public string AccID; // 社群账号的长度是30 public string Password; //size = Len,可发token public uint Version; public byte LineNO; public string MAC; //MAC地址 public string AppID; //应用编码, 接FreeSDK public uint AccountID; //用户ID与账号不同,接FreeSDK public string TokenExpire; //时间戳,毫秒级,接FreeSDK public byte Phone; //是否绑定手机 public uint ServerID; //服务器ID public byte Adult; //是否成年 0未成年 1成年 public ushort ExtraLen; //扩展长度 public string Extra; //扩展内容,根据不同平台而定 public C0101_tagCPlayerLogin() { _cmd = (ushort)0x0101; } public override void WriteToBytes() { WriteBytes(IDType, NetDataType.BYTE); WriteBytes(AccID, NetDataType.Chars, 65); WriteBytes(Password, NetDataType.Chars, 33); WriteBytes(Version, NetDataType.DWORD); WriteBytes(LineNO, NetDataType.BYTE); WriteBytes(MAC, NetDataType.Chars, 18); WriteBytes(AppID, NetDataType.Chars, 20); WriteBytes(AccountID, NetDataType.DWORD); WriteBytes(TokenExpire, NetDataType.Chars, 20); WriteBytes(Phone, NetDataType.BYTE); WriteBytes(ServerID, NetDataType.DWORD); WriteBytes(Adult, NetDataType.BYTE); WriteBytes(ExtraLen, NetDataType.WORD); WriteBytes(Extra, NetDataType.Chars, ExtraLen); } } Main/NetworkPackage/ClientPack/ClientToGameServer/C01_System/C0101_tagCPlayerLogin.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 52d1066f3a7d1e746a33468d638c1802 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/NetworkPackage/ClientPack/ClientToGameServer/C01_System/C0123_tagCClientPackVersion.cs
New file @@ -0,0 +1,31 @@ using UnityEngine; using System.Collections; //01 23 客户端封包版本号#tagCClientPackVersion public class C0123_tagCClientPackVersion : GameNetPackBasic { public uint Version; public C0123_tagCClientPackVersion () { _cmd = (ushort)0x0123; } public override void WriteToBytes () { WriteBytes(Version, NetDataType.DWORD); } } Main/NetworkPackage/ClientPack/ClientToGameServer/C01_System/C0123_tagCClientPackVersion.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 06558bd151fed91478892dbf6fb51bcf MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/NetworkPackage/ClientPack/ClientToMapServer/C01_System.meta
New file @@ -0,0 +1,8 @@ fileFormatVersion: 2 guid: 6b6dad1ef793fcc43b1c53f4f53fa171 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: Main/NetworkPackage/ClientPack/ClientToMapServer/C01_System/C0103_tagCPlayerLogOut.cs
New file @@ -0,0 +1,17 @@ using UnityEngine; using System.Collections; public class C0103_tagCPlayerLogOut : GameNetPackBasic { public short Type; public C0103_tagCPlayerLogOut () { _cmd = (ushort)0x0103; } public override void WriteToBytes () { WriteBytes (Type, NetDataType.BYTE); } } Main/NetworkPackage/ClientPack/ClientToMapServer/C01_System/C0103_tagCPlayerLogOut.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: b20000c799231334aa603eead5404ca9 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/NetworkPackage/ClientPack/ClientToMapServer/C01_System/C010D_tagCClientVersion.cs
New file @@ -0,0 +1,19 @@ using UnityEngine; using System.Collections; /** 客户端版本 */ public class C010D_tagCClientVersion : GameNetPackBasic { public ushort VersionLen; public string Version;//[VersionLen] //size = VersionLen public C010D_tagCClientVersion () { _cmd = (ushort)0x010D; } public override void WriteToBytes () { WriteBytes (Version, NetDataType.Chars, StrWriteLen.BYTE); } } Main/NetworkPackage/ClientPack/ClientToMapServer/C01_System/C010D_tagCClientVersion.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 8285c75e66ba7574e913d49f6005f957 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/NetworkPackage/ClientPack/ClientToMapServer/CA5_Function/CA504_tagCMPlayerGetReward.cs
New file @@ -0,0 +1,24 @@ using UnityEngine; using System.Collections; //A5 04 玩家领取奖励 #tagCMPlayerGetReward public class CA504_tagCMPlayerGetReward : GameNetPackBasic { public byte RewardType; //奖励类型 public uint DataEx; //附带信息 public byte DataExStrLen; //附加字符信息长度 public string DataExStr; //附加字符信息 public CA504_tagCMPlayerGetReward () { combineCmd = (ushort)0x03FE; _cmd = (ushort)0xA504; } public override void WriteToBytes () { WriteBytes (RewardType, NetDataType.BYTE); WriteBytes (DataEx, NetDataType.DWORD); WriteBytes (DataExStrLen, NetDataType.BYTE); WriteBytes (DataExStr, NetDataType.Chars, DataExStrLen); } } Main/NetworkPackage/ClientPack/ClientToMapServer/CA5_Function/CA504_tagCMPlayerGetReward.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 23fc98d0af652e749ae1435e2bc86da5 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/NetworkPackage/ServerPack/H01_System/H0101_tagServerPrepared.cs
New file @@ -0,0 +1,31 @@ using UnityEngine; using System.Collections; //01 01 服务器InitOK#tagServerPrepared public class H0101_tagServerPrepared : GameNetPackBasic { public uint Version; public H0101_tagServerPrepared () { _cmd = (ushort)0x0101; } public override void ReadFromBytes (byte[] vBytes) { TransBytes (out Version, vBytes, NetDataType.DWORD); } } Main/NetworkPackage/ServerPack/H01_System/H0101_tagServerPrepared.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 5aa9d2e49bbb1f74fb03c16c77b9b17e MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/NetworkPackage/ServerPack/H08_Event.meta
New file @@ -0,0 +1,8 @@ fileFormatVersion: 2 guid: dab11290b2c6dae4bb9f7f5ac868ff07 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: Main/NetworkPackage/ServerPack/H08_Event/H0801_tagEventTalk.cs
New file @@ -0,0 +1,62 @@ using UnityEngine; using System.Collections; //08 01 事件选择#tagEventTalk public class H0801_tagEventTalk : GameNetPackBasic { public byte Type; //1.单回答 2:多回答 3:图片通知 4:弹出通知 public uint MissionID; public tagMsgStr[] Msg = null; public byte MsgParStrCount; //参数数目 public tagMsgParStr[] MsgParStr = null; //size = MsgParStrCount public uint NPCID; public byte NameLen; public string Name; //size = NameLen public byte AnswerCount; public tagMsgStr[] Answer = null; //size = AnswerCount public H0801_tagEventTalk () { _cmd = (ushort)0x0801; } public override void ReadFromBytes (byte[] vBytes) { TransBytes (out Type, vBytes, NetDataType.BYTE); TransBytes (out MissionID, vBytes, NetDataType.DWORD); Msg = new tagMsgStr[1]; for (int i = 0; i < 1; i ++) { Msg[i] = new tagMsgStr(); TransBytes (out Msg[i].MsgLen, vBytes, NetDataType.WORD); TransBytes (out Msg[i].Msg, vBytes, NetDataType.Chars, Msg[i].MsgLen); } TransBytes (out MsgParStrCount, vBytes, NetDataType.BYTE); MsgParStr = new tagMsgParStr[MsgParStrCount]; for (int i = 0; i < MsgParStrCount; i ++) { MsgParStr[i] = new tagMsgParStr(); TransBytes (out MsgParStr[i].MsgInt, vBytes, NetDataType.DWORD); TransBytes (out MsgParStr[i].Len, vBytes, NetDataType.BYTE); TransBytes (out MsgParStr[i].Msg, vBytes, NetDataType.Chars, MsgParStr[i].Len); } TransBytes (out NPCID, vBytes, NetDataType.DWORD); TransBytes (out NameLen, vBytes, NetDataType.BYTE); TransBytes (out Name, vBytes, NetDataType.Chars, NameLen); TransBytes (out AnswerCount, vBytes, NetDataType.BYTE); Answer = new tagMsgStr[AnswerCount]; for (int i = 0; i < AnswerCount; i ++) { Answer[i] = new tagMsgStr(); TransBytes (out Answer[i].MsgLen, vBytes, NetDataType.WORD); TransBytes (out Answer[i].Msg, vBytes, NetDataType.Chars, Answer[i].MsgLen); } } public class tagMsgStr { public ushort MsgLen; public string Msg; //size = MsgLen } public class tagMsgParStr { public uint MsgInt; //int类型 public byte Len; public string Msg; //size = Len } } Main/NetworkPackage/ServerPack/H08_Event/H0801_tagEventTalk.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 0ba560a44e3fa4c439673159bdc95352 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/NetworkPackage/ServerPack/H08_Event/H0820_tagMissionDict.cs
New file @@ -0,0 +1,43 @@ using UnityEngine; using System.Collections; //08 20 任务字典信息#tagMissionDict public class H0820_tagMissionDict : GameNetPackBasic { public uint MissionID;//任务ID public byte DictKeyLen;//任务中的某个字典Key public string DictKey; //key的长度 //size = DictKeyLen public uint DictValue;//该key对应的值 public H0820_tagMissionDict () { _cmd = (ushort)0x0820; } public override void ReadFromBytes (byte[] vBytes) { TransBytes (out MissionID, vBytes, NetDataType.DWORD); TransBytes (out DictKeyLen, vBytes, NetDataType.BYTE); TransBytes (out DictKey, vBytes, NetDataType.Chars, DictKeyLen); TransBytes (out DictValue, vBytes, NetDataType.DWORD); } } Main/NetworkPackage/ServerPack/H08_Event/H0820_tagMissionDict.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: a29fffee1fddfb8498cdfd5ff5225cd4 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/NetworkPackage/ServerPack/HA3_Function/HA302_tagMCFuncOpenStateList.cs
New file @@ -0,0 +1,59 @@ using UnityEngine; using System.Collections; //A3 02 功能开通状态 #tagMCFuncOpenStateList public class HA302_tagMCFuncOpenStateList : GameNetPackBasic { public byte FuncCount; // 功能个数 public tagMCFuncOpenState[] FuncStateList; // 功能状态列表 public HA302_tagMCFuncOpenStateList () { _cmd = (ushort)0xA302; } public override void ReadFromBytes (byte[] vBytes) { TransBytes (out FuncCount, vBytes, NetDataType.BYTE); FuncStateList = new tagMCFuncOpenState[FuncCount]; for (int i = 0; i < FuncCount; i ++) { FuncStateList[i] = new tagMCFuncOpenState(); TransBytes (out FuncStateList[i].FuncID, vBytes, NetDataType.BYTE); TransBytes (out FuncStateList[i].State, vBytes, NetDataType.BYTE); TransBytes (out FuncStateList[i].AwardState, vBytes, NetDataType.BYTE); } } public struct tagMCFuncOpenState { public byte FuncID; // 功能ID public byte State; // 是否开启 public byte AwardState; // 是否已领奖励 } } Main/NetworkPackage/ServerPack/HA3_Function/HA302_tagMCFuncOpenStateList.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 229191e4cfe76fc4e8e87bf822e61cf4 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/NetworkPackage/ServerPack/HA3_Function/HA319_tagMCPackDownloadRecord.cs
New file @@ -0,0 +1,17 @@ using UnityEngine; using System.Collections; // A3 19 分包下载奖励记录 #tagMCPackDownloadRecord public class HA319_tagMCPackDownloadRecord : GameNetPackBasic { public byte Record; //0-未领取 1-已领取 public HA319_tagMCPackDownloadRecord () { _cmd = (ushort)0xA319; } public override void ReadFromBytes (byte[] vBytes) { TransBytes (out Record, vBytes, NetDataType.BYTE); } } Main/NetworkPackage/ServerPack/HA3_Function/HA319_tagMCPackDownloadRecord.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 006ef2f8630fec8438709f99fbcd0440 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/NetworkPackage/ServerPack/HA7_Interaction/HA708_tagMCRunTaskAwardInfo.cs
New file @@ -0,0 +1,31 @@ using UnityEngine; using System.Collections; // A7 08 通知跑环奖励记录 #tagMCRunTaskAwardInfo public class HA708_tagMCRunTaskAwardInfo : GameNetPackBasic { public byte Cnt; public tagMCRunTaskAwardRecord[] InfoList = null; public HA708_tagMCRunTaskAwardInfo () { _cmd = (ushort)0xA708; } public override void ReadFromBytes (byte[] vBytes) { TransBytes (out Cnt, vBytes, NetDataType.BYTE); InfoList = new tagMCRunTaskAwardRecord[Cnt]; for (int i = 0; i < Cnt; i ++) { InfoList[i] = new tagMCRunTaskAwardRecord(); TransBytes (out InfoList[i].Type, vBytes, NetDataType.BYTE); TransBytes (out InfoList[i].Num, vBytes, NetDataType.DWORD); TransBytes (out InfoList[i].AwardState, vBytes, NetDataType.BYTE); } } public class tagMCRunTaskAwardRecord { public byte Type; public uint Num; public byte AwardState; } } Main/NetworkPackage/ServerPack/HA7_Interaction/HA708_tagMCRunTaskAwardInfo.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 3b1668fbeab683d4bbc8507c65446f50 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/NetworkPackage/ServerPack/HA7_Interaction/HA717_tagMCChatBubbleBoxState.cs
New file @@ -0,0 +1,33 @@ using UnityEngine; using System.Collections; // A7 17 聊天气泡框状态 #tagMCChatBubbleBoxState public class HA717_tagMCChatBubbleBoxState : GameNetPackBasic { public byte Count; public tagMCChatBubbleBox[] BoxList; public HA717_tagMCChatBubbleBoxState () { _cmd = (ushort)0xA717; } public override void ReadFromBytes (byte[] vBytes) { TransBytes (out Count, vBytes, NetDataType.BYTE); BoxList = new tagMCChatBubbleBox[Count]; for (int i = 0; i < Count; i ++) { BoxList[i] = new tagMCChatBubbleBox(); TransBytes (out BoxList[i].BoxID, vBytes, NetDataType.BYTE); TransBytes (out BoxList[i].State, vBytes, NetDataType.BYTE); TransBytes (out BoxList[i].EndTime, vBytes, NetDataType.DWORD); TransBytes (out BoxList[i].Star, vBytes, NetDataType.BYTE); } } public struct tagMCChatBubbleBox { public byte BoxID; //气泡ID public byte State; //是否已激活 public uint EndTime; //到期时间戳,0为永久 public byte Star; //星级 } } Main/NetworkPackage/ServerPack/HA7_Interaction/HA717_tagMCChatBubbleBoxState.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: aaebeb73934873643b8350191cbc297e MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/SDK/SDKUtils.cs
@@ -1383,7 +1383,7 @@ return; // TODO YYL if (DTC0403_tagPlayerLoginLoadOK.neverLoginOk) return; if (DTC0403_tagPlayerLoginLoadOK.neverLoginOk) return; m_Json.Clear(); m_Json["code"] = CodeU2A.RoleLoginOut; Main/System/AssetVersion/DownLoadAndDiscompressTask.cs
@@ -136,12 +136,8 @@ step = Step.Completed; // TODO YYL // UIManager.Instance.OpenWindow<DownLoadWin>(); // UIManager.Instance.OpenWindow<InGameDownLoadWin>(); // WindowCenter.Instance.Close<DownLoadWin>(); // WindowCenter.Instance.Close<InGameDownLoadWin>(); UIManager.Instance.OpenWindow<DownLoadWin>(); UIManager.Instance.OpenWindow<InGameDownLoadWin>(); if (downLoadOkCallBack != null) { Main/System/AssetVersion/DownLoadWin.cs
New file @@ -0,0 +1,155 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Tuesday, January 09, 2018 //-------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class DownLoadWin : UIBase { [SerializeField] RectTransform m_ContainerHint; [SerializeField] RichText m_Content; [SerializeField] Button m_Confirm; [SerializeField] Button m_Cancel; [SerializeField] Transform m_ContainerProgress; [SerializeField] SmoothSlider m_ProgressSlider; [SerializeField] Text m_Progress; [SerializeField] Text m_DownLoadSpeed; [SerializeField] Transform awardObj; float timer = 1f; protected override void InitComponent() { m_Confirm.AddListener(Confirm); m_Cancel.AddListener(Cancel); } protected override void OnPreOpen() { timer = 1f; if (Application.internetReachability == NetworkReachability.ReachableViaLocalAreaNetwork) { DownLoadAndDiscompressTask.Instance.StartDownLoad(); } OnDownLoadStepChange(DownLoadAndDiscompressTask.Instance.step); awardObj.SetActive(InGameDownLoad.Instance.IsShowDownloadAward()); } protected override void OnOpen() { DownLoadAndDiscompressTask.Instance.downLoadStepChangeEvent += OnDownLoadStepChange; } protected override void OnPreClose() { DownLoadAndDiscompressTask.Instance.downLoadStepChangeEvent -= OnDownLoadStepChange; } protected override void OnClose() { } private void OnDownLoadStepChange(DownLoadAndDiscompressTask.Step _step) { switch (_step) { case DownLoadAndDiscompressTask.Step.DownLoadPrepared: m_ContainerHint.SetActive(true); m_ContainerProgress.SetActive(false); DisplayHintContent(); break; case DownLoadAndDiscompressTask.Step.DownLoad: m_ContainerHint.SetActive(false); m_ContainerProgress.SetActive(true); DisplayHintContent(); break; } } protected void LateUpdate() { var step = DownLoadAndDiscompressTask.Instance.step; if (step == DownLoadAndDiscompressTask.Step.DownLoad) { timer += Time.deltaTime; if (timer > 1f) { timer -= 1f; m_ProgressSlider.value = DownLoadAndDiscompressTask.Instance.progress; var totalSizeString = ((float)DownLoadAndDiscompressTask.Instance.totalSize / DownLoadAndDiscompressTask.BYTE_PER_MILLIONBYTE).ToString("f1"); var downLoadedSize = Mathf.Clamp(DownloadMgr.Instance.DownloadedBytes, 0, DownLoadAndDiscompressTask.Instance.totalSize - 1); var downLoadedSizeString = ((float)downLoadedSize / DownLoadAndDiscompressTask.BYTE_PER_MILLIONBYTE).ToString("f1"); m_Progress.text = Language.GetFromLocal(13, StringUtility.Contact(downLoadedSizeString, "M", "/", totalSizeString, "M")); if (downLoadedSize >= DownLoadAndDiscompressTask.Instance.totalSize) { m_DownLoadSpeed.text = StringUtility.Contact(UnityEngine.Random.Range(5, 10), "KB/S"); } else { m_DownLoadSpeed.text = DownloadMgr.Instance.SpeedFormat; } } } } private void DisplayHintContent() { var step = DownLoadAndDiscompressTask.Instance.step; switch (step) { case DownLoadAndDiscompressTask.Step.DownLoadPrepared: var totalCount = DownLoadAndDiscompressTask.Instance.totalCount; var totalSize = DownLoadAndDiscompressTask.Instance.totalSize; if (totalSize > DownLoadAndDiscompressTask.BYTE_PER_MILLIONBYTE) { var sizeDescription = ((float)totalSize / DownLoadAndDiscompressTask.BYTE_PER_MILLIONBYTE).ToString("f1"); m_Content.text = Language.GetFromLocal(DownLoadAndDiscompressTask.Instance.restartApp ? 1 : 2, totalCount, sizeDescription); } else { var sizeDescription = ((float)totalSize / DownLoadAndDiscompressTask.BYTE_PER_KILOBYTE).ToString("f1"); m_Content.text = Language.GetFromLocal(DownLoadAndDiscompressTask.Instance.restartApp ? 11 : 12, totalCount, sizeDescription); } break; case DownLoadAndDiscompressTask.Step.DownLoad: m_Content.text = Language.GetFromLocal(3); break; } } private void Confirm() { timer = 1f; var step = DownLoadAndDiscompressTask.Instance.step; switch (step) { case DownLoadAndDiscompressTask.Step.DownLoadPrepared: DownLoadAndDiscompressTask.Instance.StartDownLoad(); break; } } private void Cancel() { Application.Quit(); } } Main/System/AssetVersion/DownLoadWin.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: ad2de3d60614cb44a86ffb8cc10b01b0 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/System/AssetVersion/InGameDownLoad.cs
@@ -79,8 +79,6 @@ } } // TaskModel taskModel { get { return ModelCenter.Instance.GetModel<TaskModel>(); } } public List<Reward> rewards = new List<Reward>(); public bool hasReward { get; private set; }//是否有奖励 public string completeDownLoadAccount @@ -89,8 +87,7 @@ set { LocalSave.SetString("InGameDownLoadCompleteAccount", value); } } // TODO YYL // public Redpoint downLoadRedpoint = new Redpoint(116); public Redpoint downLoadRedpoint = new Redpoint(116); private void Awake() { @@ -138,45 +135,46 @@ //开始分配任务 public void AssignTasks(List<AssetVersion> assets, Action _onDownLoadOk) { this.inGameDownLoadAllow = false; this.assets = assets; this.assets.Sort(this.AssetDownLoadPriorCompare);//所有任务根据优先级排序 onDownLoadOk = _onDownLoadOk; totalCount = this.assets.Count; okCount = 0; totalSize = 0; DownloadMgr.Instance.Prepare(); for (int i = 0; i < this.assets.Count; i++) { var assetVersion = this.assets[i]; totalSize += assetVersion.size;//统计资源总大小 //统计地图专属的资源 TODO YYL // var mapId = PriorBundleConfig.GetAssetBelongToMap(assetVersion.GetAssetCategory(), AssetVersionUtility.DecodeFileName(assetVersion.fileName)); // if (mapId != 0) // { // if (!mapTasks.ContainsKey(mapId)) // { // mapTasks[mapId] = new List<AssetVersion>(); // } // mapTasks[mapId].Add(assetVersion); // } //添加下载任务 var remoteURL = StringUtility.Contact(VersionUtility.Instance.versionInfo.GetResourcesURL(VersionConfig.Get().branch), Language.fixPath, "/", assetVersion.relativePath); var localURL = StringUtility.Contact(ResourcesPath.Instance.ExternalStorePath, assetVersion.relativePath); DownloadMgr.Instance.AddTask(new DownloadTask(remoteURL, localURL, assetVersion)); } state = State.None; // TODO YYL // this.inGameDownLoadAllow = false; // this.assets = assets; // this.assets.Sort(this.AssetDownLoadPriorCompare);//所有任务根据优先级排序 // onDownLoadOk = _onDownLoadOk; TaskManager.Event_MainlineTask -= OnMainTaskChange; TaskManager.Event_MainlineTask += OnMainTaskChange; // totalCount = this.assets.Count; // okCount = 0; // totalSize = 0; // DownloadMgr.Instance.Prepare(); // for (int i = 0; i < this.assets.Count; i++) // { // var assetVersion = this.assets[i]; // totalSize += assetVersion.size;//统计资源总大小 // //统计地图专属的资源 // var mapId = PriorBundleConfig.GetAssetBelongToMap(assetVersion.GetAssetCategory(), AssetVersionUtility.DecodeFileName(assetVersion.fileName)); // if (mapId != 0) // { // if (!mapTasks.ContainsKey(mapId)) // { // mapTasks[mapId] = new List<AssetVersion>(); // } // mapTasks[mapId].Add(assetVersion); // } // //添加下载任务 // var remoteURL = StringUtility.Contact(VersionUtility.Instance.versionInfo.GetResourcesURL(VersionConfig.Get().branch), Language.fixPath, "/", assetVersion.relativePath); // var localURL = StringUtility.Contact(ResourcesPath.Instance.ExternalStorePath, assetVersion.relativePath); // DownloadMgr.Instance.AddTask(new DownloadTask(remoteURL, localURL, assetVersion)); // } // state = State.None; // TaskModel.Event_MainlineTask -= OnMainTaskChange; // TaskModel.Event_MainlineTask += OnMainTaskChange; // PlayerDatas.Instance.playerDataRefreshEvent -= OnPlayerLevelChange; // PlayerDatas.Instance.playerDataRefreshEvent += OnPlayerLevelChange; PlayerDatas.Instance.playerDataRefreshEvent -= OnPlayerLevelChange; PlayerDatas.Instance.playerDataRefreshEvent += OnPlayerLevelChange; } //任务根据优先级排序 @@ -185,8 +183,7 @@ var categoryA = lhs.GetAssetCategory(); var categoryB = rhs.GetAssetCategory(); // TODO YYL // TODO YYL // var priorA = PriorBundleConfig.GetAssetPrior(categoryA, AssetVersionUtility.DecodeFileName(lhs.fileName)); // var priorB = PriorBundleConfig.GetAssetPrior(categoryB, AssetVersionUtility.DecodeFileName(rhs.fileName)); @@ -272,8 +269,7 @@ state = State.Prepared; } dominantState = Dominant.Whole; // TODO YYL // UIManager.Instance.ShowWindow<InGameDownLoadWin>(); UIManager.Instance.OpenWindow<InGameDownLoadWin>(); // // WindowCenter.Instance.Open<InGameDownLoadWin>(); break; } @@ -316,70 +312,67 @@ private void OnDownLoadFinished() { // TODO YYL // TaskModel.Event_MainlineTask -= OnMainTaskChange; // PlayerDatas.Instance.playerDataRefreshEvent -= OnPlayerLevelChange; TaskManager.Event_MainlineTask -= OnMainTaskChange; PlayerDatas.Instance.playerDataRefreshEvent -= OnPlayerLevelChange; // WindowCenter.Instance.Close<InGameDownLoadWin>(); UIManager.Instance.CloseWindow<InGameDownLoadWin>(); // if (!hasReward) // { // if (dominantState == Dominant.None) // { // RequestDownLoadReward(false); // state = State.Completed; // } // else // { // completeDownLoadAccount = PlayerDatas.Instance.baseData.AccID; // state = State.Award; // } // } // else // { // state = State.Completed; // } if (!hasReward) { if (dominantState == Dominant.None) { RequestDownLoadReward(false); state = State.Completed; } else { completeDownLoadAccount = PlayerDatas.Instance.baseData.AccID; state = State.Award; } } else { state = State.Completed; } // downLoadRedpoint.state = state == State.Award ? RedPointState.Simple : RedPointState.None; downLoadRedpoint.state = state == State.Award ? RedPointState.Simple : RedPointState.None; // if (onDownLoadOk != null) // { // onDownLoadOk(); // onDownLoadOk = null; // } if (onDownLoadOk != null) { onDownLoadOk(); onDownLoadOk = null; } } public void ParseRewardConfig() { // // TODO YYL // var rewardString = FuncConfigConfig.Get("DownReward").Numerical1; // var matches = Regex.Matches(rewardString, "(\\d+,\\d+,\\d+)"); // for (int i = 0; i < matches.Count; i++) // { // rewards.Add(new Reward(matches[i].Value)); // } var rewardString = FuncConfigConfig.Get("DownReward").Numerical1; var matches = Regex.Matches(rewardString, "(\\d+,\\d+,\\d+)"); for (int i = 0; i < matches.Count; i++) { rewards.Add(new Reward(matches[i].Value)); } } // TODO YYL // public void UpdateRewardInfo(HA319_tagMCPackDownloadRecord _package) // { // hasReward = _package.Record == 1; public void UpdateRewardInfo(HA319_tagMCPackDownloadRecord _package) { hasReward = _package.Record == 1; // if (AssetVersionUtility.unPriorAssetDownLoadDone) // { // state = !hasReward && completeDownLoadAccount == PlayerDatas.Instance.baseData.AccID ? State.Award : State.Completed; // } if (AssetVersionUtility.unPriorAssetDownLoadDone) { state = !hasReward && completeDownLoadAccount == PlayerDatas.Instance.baseData.AccID ? State.Award : State.Completed; } // downLoadRedpoint.state = state == State.Award ? RedPointState.Simple : RedPointState.None; // } downLoadRedpoint.state = state == State.Award ? RedPointState.Simple : RedPointState.None; } public void RequestDownLoadReward(bool _manual) { // TODO YYL // var send = new CA504_tagCMPlayerGetReward(); // send.RewardType = 15; // send.DataEx = (byte)(_manual ? 0 : 1); // GameNetSystem.Instance.SendInfo(send); var send = new CA504_tagCMPlayerGetReward(); send.RewardType = 15; send.DataEx = (byte)(_manual ? 0 : 1); GameNetSystem.Instance.SendInfo(send); } public float GetMapAssetDownLoadProgress(int mapId) @@ -540,11 +533,10 @@ } // TODO YYL // if (!WindowCenter.Instance.IsOpen("MainInterfaceWin")) // { // return false; // } if (!UIManager.Instance.IsOpened<MainWin>()) { return false; } // if (WindowCenter.Instance.ExistAnyFullScreenOrMaskWin()) // { @@ -589,24 +581,22 @@ //主线任务任务状态变更和刷新 private void OnMainTaskChange(int _taskId, int _state) { // TODO YYL // var mainTaskId = taskModel.currentMission; // if (GeneralDefine.inGameDownLoadTaskCheckPoints.Contains(mainTaskId) // && taskModel.currentMissionState == 1) // { // if (CheckDominantDownLoad()) // { // TryDownLoad(Dominant.Whole); // } // } var mainTaskId = TaskManager.Instance.currentMission; if (GeneralDefine.inGameDownLoadTaskCheckPoints.Contains(mainTaskId) && TaskManager.Instance.currentMissionState == 1) { if (CheckDominantDownLoad()) { TryDownLoad(Dominant.Whole); } } } //获取最大下载任务数 public int GetMaxTask() { // TODO YYL // if (!LoginWin.firstOpenEnd) // return 20; if (!LoginWin.firstOpenEnd) return 20; if (downLoadGo) return 20; Main/System/AssetVersion/InGameDownLoadWin.cs
New file @@ -0,0 +1,206 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Wednesday, May 23, 2018 //-------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class InGameDownLoadWin : UIBase { [SerializeField] RectTransform m_RewardGotSign; // [SerializeField] RewardPreviewGroup m_RewardGroup; [SerializeField] RectTransform m_ContainerHint; [SerializeField] RichText m_Content; [SerializeField] Button m_StartDownLoad; [SerializeField] Button m_PauseDownLoad; [SerializeField] Button m_Award; [SerializeField] Button m_Close; [SerializeField] Transform m_ContainerProgress; [SerializeField] SmoothSlider m_ProgressSlider; [SerializeField] Text m_Progress; [SerializeField] Text m_DownLoadSpeed; [SerializeField] ToggleButton downLoadGo; //加速下载 float timer = 1f; #region Built-in protected override void InitComponent() { m_StartDownLoad.AddListener(StartDownLoad); m_PauseDownLoad.AddListener(PauseDownLoad); m_Award.AddListener(Award); m_Close.AddListener(CloseWindow); downLoadGo.SetListener(() => { downLoadGo.isOn = !downLoadGo.isOn; InGameDownLoad.Instance.downLoadGo = downLoadGo.isOn; DownloadMgr.MaxDownLoadTask = InGameDownLoad.Instance.GetMaxTask(); }); } protected override void OnPreOpen() { timer = 1f; m_RewardGotSign.SetActive(InGameDownLoad.Instance.hasReward); // var items = new List<Item>(); // foreach (var reward in InGameDownLoad.Instance.rewards) // { // items.Add(new Item(reward.id, reward.count)); // } // m_RewardGroup.Display(items); OnDownLoadStepChange(InGameDownLoad.Instance.state); downLoadGo.isOn = InGameDownLoad.Instance.downLoadGo; } protected override void OnOpen() { InGameDownLoad.Instance.downLoadStateChangeEvent += OnDownLoadStepChange; } protected override void OnPreClose() { InGameDownLoad.Instance.downLoadStateChangeEvent -= OnDownLoadStepChange; } protected override void OnClose() { } #endregion private void OnDownLoadStepChange(InGameDownLoad.State _step) { m_Award.SetActive(_step == InGameDownLoad.State.Award); m_PauseDownLoad.SetActive(_step == InGameDownLoad.State.DownLoad); m_StartDownLoad.SetActive(_step == InGameDownLoad.State.Prepared || _step == InGameDownLoad.State.Pause); m_ContainerProgress.SetActive(_step == InGameDownLoad.State.DownLoad || _step == InGameDownLoad.State.Pause); if (_step != InGameDownLoad.State.DownLoad) { m_DownLoadSpeed.text = string.Empty; } if (_step == InGameDownLoad.State.Prepared || _step == InGameDownLoad.State.Award) { m_ContainerHint.SetActive(true); DisplayHintContent(); } else { m_ContainerHint.SetActive(false); } } protected void LateUpdate() { var step = InGameDownLoad.Instance.state; if (step == InGameDownLoad.State.DownLoad) { timer += Time.deltaTime; if (timer > 1f) { timer -= 1f; m_ProgressSlider.value = InGameDownLoad.Instance.progress; var totalSizeString = ((float)InGameDownLoad.Instance.showTotalSize / InGameDownLoad.BYTE_PER_MILLIONBYTE).ToString("f1"); var downLoadedSize = Mathf.Clamp(InGameDownLoad.Instance.showDownLoadedSize, 0, InGameDownLoad.Instance.showTotalSize - 1); var downLoadedSizeString = ((float)downLoadedSize / InGameDownLoad.BYTE_PER_MILLIONBYTE).ToString("f1"); m_Progress.text = Language.GetFromLocal(13, StringUtility.Contact(downLoadedSizeString, "M", "/", totalSizeString, "M")); if (InGameDownLoad.Instance.showDownLoadedSize >= InGameDownLoad.Instance.showTotalSize) { m_DownLoadSpeed.text = StringUtility.Contact(UnityEngine.Random.Range(5, 10), "KB/S"); } else { m_DownLoadSpeed.text = DownloadMgr.Instance.SpeedFormat; } } } } private void DisplayHintContent() { var step = InGameDownLoad.Instance.state; switch (step) { case InGameDownLoad.State.Prepared: var totalCount = InGameDownLoad.Instance.showTotalCount; var totalSize = InGameDownLoad.Instance.showTotalSize; if (totalSize > InGameDownLoad.BYTE_PER_MILLIONBYTE) { var sizeDescription = ((float)totalSize / InGameDownLoad.BYTE_PER_MILLIONBYTE).ToString("f1"); m_Content.text = Language.GetFromLocal(19, sizeDescription); } else { var sizeDescription = ((float)totalSize / InGameDownLoad.BYTE_PER_KILOBYTE).ToString("f1"); m_Content.text = Language.GetFromLocal(20, sizeDescription); } break; case InGameDownLoad.State.DownLoad: m_Content.text = Language.GetFromLocal(3); break; case InGameDownLoad.State.Pause: m_Content.text = Language.GetFromLocal(21); break; case InGameDownLoad.State.Award: m_Content.text = Language.GetFromLocal(25); break; } } private void StartDownLoad() { timer = 1f; switch (InGameDownLoad.Instance.state) { case InGameDownLoad.State.Prepared: case InGameDownLoad.State.Pause: if (Application.internetReachability == NetworkReachability.NotReachable) { ServerTipDetails.DisplayNormalTip(Language.GetFromLocal(24)); } else { InGameDownLoad.Instance.StartDownLoad(); CloseWindow(); } break; default: CloseWindow(); break; } } private void PauseDownLoad() { timer = 1f; switch (InGameDownLoad.Instance.state) { case InGameDownLoad.State.DownLoad: InGameDownLoad.Instance.Pause(); break; default: break; } } private void Award() { InGameDownLoad.Instance.RequestDownLoadReward(true); UIManager.Instance.CloseWindow<InGameDownLoadWin>(); } } Main/System/AssetVersion/InGameDownLoadWin.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 7d4f782c410e477489073e6e9d3dd013 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/System/Backpack/BackpackData.cs
@@ -5,8 +5,6 @@ using UnityEngine; using System.Collections; namespace vnxbqy.UI { public struct Item { @@ -73,8 +71,4 @@ this.countEx = (ulong)_count; } #endregion } } } Main/System/Chat/ChatBubbleBehaviour.cs
New file @@ -0,0 +1,257 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; [DisallowMultipleComponent] [RequireComponent(typeof(RectTransform))] [ExecuteAlways] public class ChatBubbleBehaviour : MonoBehaviour { [SerializeField] Text m_Target; [SerializeField] RectOffset m_Padding; [SerializeField] FlipImage m_Flip; [SerializeField] Image m_BubbleIcon; [SerializeField] bool left = false; [SerializeField] bool m_PreferredWidth = false; [SerializeField] RectTransform m_ContainerVoice; const float space = 5.0f; private int bubbleId = 0; RectTransform m_Rect; RectTransform rect { get { if (m_Rect == null) { m_Rect = transform as RectTransform; } return m_Rect; } } public RectOffset padding { get { return m_Padding; } } private void OnEnable() { Refresh(); } public void DisplayContent(string content, bool _left = false) { if (m_Target == null) { return; } left = _left; m_PreferredWidth = true; var targetRect = m_Target.rectTransform; var richText = m_Target as RichText; if (richText != null && !left) { richText.AutoNewLine = false; } m_Target.text = content; if (!left) { if (m_Target.preferredWidth > targetRect.rect.width) { m_Target.alignment = TextAnchor.UpperLeft; m_PreferredWidth = false; } else { m_Target.alignment = TextAnchor.UpperRight; } } if (richText != null) { richText.AutoNewLine = true; } Refresh(); } public void DisplayBubble(int id) { bubbleId = id; ChatBubbleManager.ChatBubble bubble; if (ChatBubbleManager.Instance.TryGetBubble(id, out bubble)) { var bubblePadding = left ? bubble.leftPadding : bubble.rifhtPadding; padding.top = bubblePadding.top; padding.left = bubblePadding.left; padding.right = bubblePadding.right; padding.bottom = bubblePadding.bottom; bool requireFlip = false; var iconKey = bubble.GetBubbleIcon(left, ref requireFlip); //m_BubbleIcon.SetSprite(iconKey); UIFrame frame = m_BubbleIcon.GetComponent<UIFrame>(); if (UIFrameMgr.Inst.ContainsDynamicImage(iconKey)) { if (frame == null) frame = m_BubbleIcon.gameObject.AddComponent<UIFrame>(); frame.ResetFrame(iconKey); frame.enabled = true; } else { if (frame != null) frame.enabled = false; m_BubbleIcon.SetSprite(iconKey); } m_Flip.flipHorizontal = requireFlip; m_Target.color = bubble.color; var position = rect.anchoredPosition; // TODO YYL // ChatBubbleBoxConfig config = ChatBubbleBoxConfig.Get(bubbleId); // position.y = -config.top; if (rect.anchoredPosition != position) { rect.anchoredPosition = position; } Refresh(); } } [ExecuteAlways] private void LateUpdate() { Refresh(); } void Refresh() { if (m_Target == null) { return; } bool nullContent = string.IsNullOrEmpty(m_Target.text); var targetRect = m_Target.rectTransform; var sizeDelta = targetRect.sizeDelta; var width = m_PreferredWidth || !Application.isPlaying ? m_Target.preferredWidth : sizeDelta.x; if (nullContent) { width = 0f; } var height = sizeDelta.y; if (nullContent) { height = 0; } if (m_ContainerVoice != null) { width = Mathf.Max(m_ContainerVoice.sizeDelta.x, width); height += m_ContainerVoice.sizeDelta.y; if (!nullContent) { height += space; } } sizeDelta.x = width + m_Padding.left + m_Padding.right; sizeDelta.y = height + m_Padding.top + m_Padding.bottom; if (sizeDelta != rect.sizeDelta) { rect.sizeDelta = sizeDelta; } SetAnchor(m_Target.rectTransform); if (m_ContainerVoice != null) { SetAnchor(m_ContainerVoice); } float top = padding.top; Vector2 position = Vector2.zero; position.x = left ? padding.left : -padding.right; if (m_ContainerVoice != null) { position.y = -top; if (m_ContainerVoice.anchoredPosition != position) { m_ContainerVoice.anchoredPosition = position; } top = top + m_ContainerVoice.sizeDelta.y; top += space; } position.y = -top; if (targetRect.anchoredPosition != position) { targetRect.anchoredPosition = position; } } void SetAnchor(RectTransform targetRect) { if (!left) { if (targetRect.anchorMin != Vector2.one) { targetRect.anchorMin = Vector2.one; } if (targetRect.anchorMax != Vector2.one) { targetRect.anchorMax = Vector2.one; } if (targetRect.pivot != Vector2.one) { targetRect.pivot = Vector2.one; } } else { if (targetRect.anchorMin != Vector2.up) { targetRect.anchorMin = Vector2.up; } if (targetRect.anchorMax != Vector2.up) { targetRect.anchorMax = Vector2.up; } if (targetRect.pivot != Vector2.up) { targetRect.pivot = Vector2.up; } } } public float GetBubbleHeight(string content, ArrayList list) { if (m_Target is RichText) { (m_Target as RichText).SetExtenalData(list); } m_Target.text = content; var height = m_Target.preferredHeight; bool nullContent = string.IsNullOrEmpty(content); if (nullContent) { height = 0f; } if (m_ContainerVoice != null) { height += m_ContainerVoice.sizeDelta.y; if (!nullContent) { height += space; } } return height + padding.top + padding.bottom; } } Main/System/Chat/ChatBubbleBehaviour.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: f7b5c980e990ee84180ced5586575bcd MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/System/Chat/ChatChannelCell.cs
New file @@ -0,0 +1,31 @@ using vnxbqy.UI; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using EnhancedUI.EnhancedScroller; public class ChatChannelCell : ScrollerUI { [SerializeField] Image m_Select; [SerializeField] Text m_ChannelName; private static Color unselectedColor = new Color32(237, 161, 13, 255); private static Color selectedColor = new Color32(255, 244, 205, 255); public override void Refresh(CellView cell) { var _type = (ChatInfoType)cell.index; if (_type == ChatInfoType.Friend) { m_ChannelName.text = Language.Get("PlayerDetail_PrivateChat"); } else { m_ChannelName.text = Language.Get(StringUtility.Contact("ChatType_", _type.ToString())); } m_Select.SetActive(_type == ChatManager.Instance.presentChatType); m_ChannelName.color = _type == ChatManager.Instance.presentChatType ? selectedColor : unselectedColor; } } Main/System/Chat/ChatChannelCell.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 6c06ce11d5cc99840934ed275c4f8859 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/System/Chat/ChatContentBehaviour.cs
New file @@ -0,0 +1,534 @@ using System; using System.Collections; using System.Collections.Generic; using System.Text.RegularExpressions; using UnityEngine; using UnityEngine.UI; using EnhancedUI.EnhancedScroller; // TODO YYL public class ChatContentBehaviour : MonoBehaviour { [SerializeField] ScrollerController m_ChatContentControl; [SerializeField] RichText m_DestSysText; [SerializeField] RichText m_DestTipText; [SerializeField] RectTransform m_ContaienrNewInfo; [SerializeField] Text m_NewInfoText; [SerializeField] Button m_NewInfoBtn; [SerializeField] Button m_LockAreaBtn; [SerializeField] Image m_LockAreaCheck; [SerializeField] RectTransform m_ContainerDisplay; [SerializeField] RectTransform m_ContainerPrivateChatRemind; [SerializeField] RectTransform m_Scroller; [SerializeField, Header("锁定当前区域比例"), Range(0, 1)] float m_Percent = 0.3f; [SerializeField] ChatPlayerMineCell m_ChatMineCell; [SerializeField] ChatPlayerOtherCell m_ChatOtherCell; // [SerializeField] ChatMineVoiceCell m_ChatMineVoiceCell; // [SerializeField] ChatOtherVoiceCell m_ChatOtherVoiceCell; private ChatInfoType m_ChatType = ChatInfoType.System; public ChatInfoType chatType { get { return m_ChatType; } set { bool isChange = m_ChatType != value; ResetNewInfo(); m_ChatType = value; DisplayChatContent(); if (isChange) { DisplayChatRemind(); } } } public ScrollerController chatContentControl { get { return m_ChatContentControl; } } private int cacheChatCount = 0; private bool onCheckArea = false; // FriendsModel friendModel // { // get { return ModelCenter.Instance.GetModel<FriendsModel>(); } // } private void Awake() { m_ChatContentControl.OnGetDynamicSize += OnGetChatDynamicSize; m_NewInfoBtn.onClick.AddListener(OnNewInfo); m_LockAreaBtn.onClick.AddListener(OnLockAreaBtn); m_ChatContentControl.mScrollRect.onValueChanged.AddListener(OnScrollValChange); if (m_DestSysText.font == null) { m_DestSysText.font = FontUtility.preferred; } if (m_DestTipText.font == null) { m_DestTipText.font = FontUtility.preferred; } } private void OnEnable() { DisplayChatContent(); DisplayChatRemind(); ChatManager.OnRefreshChat += OnRefreshChat; ChatManager.OnRefreshPteChat += OnRefreshPteChat; ChatManager.OnRefreshSelf += OnRefreshSelf; ChatManager.Instance.OnPteChatChangeEvent += OnPteChatChangeEvent; ChatCenter.Instance.UpdateChatContent += UpdateChatContent; PlayerDatas.Instance.playerDataRefreshEvent += PlayerDataRefreshInfoEvent; // friendModel.RefreshFriendCntEvent += RefreshFriendCntEvent; // friendModel.RefreshFriendModel += DisplayChatRemind; ResetNewInfo(); UpdateChatContent(); if (m_ChatType == ChatInfoType.Friend) { DisplayChatContent(); JumpPteChatBottom(); } } private void OnPteChatChangeEvent() { if (m_ChatType == ChatInfoType.Friend) { DisplayChatContent(); DisplayChatRemind(); JumpPteChatBottom(); } } private void OnRefreshSelf(ChatData data) { ChatCenter.Instance.ChangeChatValue(string.Empty, false, false); ChatManager.Instance.itemPlaceList.Clear(); if (m_ChatType == ChatInfoType.Friend) { JumpPteChatBottom(); } else { ChatManager.Instance.lockUpdate = false; } UpdateChatContent(); } private void OnRefreshPteChat(ChatFriendData data) { if (data == null) { return; } if (data.toPlayer != ChatManager.Instance.PteChatID && data.player != ChatManager.Instance.PteChatID) { return; } DisplayChatContent(true); float _displaySize = 0; if (m_ChatContentControl.mScrollRect != null) { _displaySize = m_ChatContentControl.mScrollRect.content.sizeDelta.y; } if (data.player == PlayerDatas.Instance.baseData.PlayerID) { OnRefreshSelf(data); } else if (ChatManager.Instance.lockUpdate && _displaySize > m_ChatContentControl.m_Scorller.ScrollRectSize) { cacheChatCount++; cacheChatCount = Mathf.Min(cacheChatCount, 999); m_NewInfoText.text = Language.Get("ChatNewWord", cacheChatCount); m_ContaienrNewInfo.SetActive(true); } } private void OnScrollValChange(Vector2 _pos) { if (m_ChatContentControl.mScrollRect.verticalNormalizedPosition < 0.1f && m_ChatType == ChatInfoType.Friend) { ResetNewInfo(); } if (m_ChatContentControl.m_Scorller._ScrollSize <= 0 || m_ChatType == ChatInfoType.Friend) { return; } float _value = m_Percent / m_ChatContentControl.m_Scorller._ScrollSize * m_ChatContentControl.m_Scorller.ScrollRectSize; if (_pos.y <= _value) { if (ChatManager.Instance.lockUpdate && !onCheckArea) { ChatManager.Instance.lockUpdate = false; UpdateLockAreaState(); ResetNewInfo(); } onCheckArea = true; } else { if (!ChatManager.Instance.lockUpdate) { ChatManager.Instance.lockUpdate = true; UpdateChatContent(); } onCheckArea = false; } } private void OnLockAreaBtn() { ChatManager.Instance.lockUpdate = !ChatManager.Instance.lockUpdate; UpdateChatContent(); } private void OnRefreshChat(ChatInfoType _type) { if (_type == m_ChatType) { DisplayChatContent(true); float _displaySize = 0; if (m_ChatContentControl.mScrollRect != null) { _displaySize = m_ChatContentControl.mScrollRect.content.sizeDelta.y; } if (ChatManager.Instance.lockUpdate && _displaySize > m_ChatContentControl.m_Scorller.ScrollRectSize) { cacheChatCount++; cacheChatCount = Mathf.Min(cacheChatCount, 999); m_NewInfoText.text = Language.Get("ChatNewWord", cacheChatCount); m_ContaienrNewInfo.SetActive(true); } } } private void ResetNewInfo() { cacheChatCount = 0; if (m_ContaienrNewInfo.gameObject.activeSelf) { m_ContaienrNewInfo.SetActive(false); } } private void DisplayChatContent(bool _keep = false) { float _offset = KeepArea(); m_ChatContentControl.Refresh(); if (m_ChatType != ChatInfoType.Friend) { List<ChatData> _list = ChatManager.Instance.GetChatInfo(m_ChatType); if (_list != null) { for (int i = 0; i < _list.Count; i++) { switch (_list[i].type) { case ChatInfoType.World: case ChatInfoType.Area: case ChatInfoType.CrossServer: case ChatInfoType.Team: case ChatInfoType.Trumpet: case ChatInfoType.Fairy: case ChatInfoType.default1: case ChatInfoType.default2: ChatUeseData data = _list[i] as ChatUeseData; if (data.detailType == ChatInfoType.FairyQuestion || data.detailType == ChatInfoType.FairyTip || data.detailType == ChatInfoType.TeamTip || data.detailType == ChatInfoType.default2) { m_ChatContentControl.AddCell(ScrollerDataType.Extra1, i); } else { if (data.IsSound) { m_ChatContentControl.AddCell(data.player == PlayerDatas.Instance.PlayerId ? ScrollerDataType.Extra2 : ScrollerDataType.Extra3, i); break; } if (data.player == PlayerDatas.Instance.baseData.PlayerID) { m_ChatContentControl.AddCell(ScrollerDataType.Header, i); } else { m_ChatContentControl.AddCell(ScrollerDataType.Normal, i); } } break; case ChatInfoType.Invite: case ChatInfoType.System: { m_ChatContentControl.AddCell(ScrollerDataType.Tail, i); } break; } } } } else { List<ChatFriendData> _list = ChatManager.Instance.GetChatInfo(ChatManager.Instance.PteChatID); if (_list != null) { for (int i = 0; i < _list.Count; i++) { if (_list[i].IsSound) { m_ChatContentControl.AddCell(_list[i].player == PlayerDatas.Instance.PlayerId ? ScrollerDataType.Extra2 : ScrollerDataType.Extra3, i); continue; } if (Regex.IsMatch(_list[i].content, ChatManager.KILL_IDENTIFY)) { m_ChatContentControl.AddCell(ScrollerDataType.Tail, i); continue; } if (_list[i].player == PlayerDatas.Instance.baseData.PlayerID) { m_ChatContentControl.AddCell(ScrollerDataType.Header, i); } else { m_ChatContentControl.AddCell(ScrollerDataType.Normal, i); } } } } m_ChatContentControl.Restart(); if (_keep && ChatManager.Instance.lockUpdate) { m_ChatContentControl.JumpIndex(-_offset, 0, EnhancedUI.EnhancedScroller.EnhancedScroller.TweenType.immediate); } m_LockAreaBtn.SetActive(m_ChatType != ChatInfoType.Friend); } private void DisplayChatRemind() { if (m_ContainerPrivateChatRemind != null) { // bool requireRemind = false; // var _dict = friendModel.GetFriendInfoDict((byte)GroupType.RecentContact); // if (m_ChatType == ChatInfoType.Friend) // { // if (WindowCenter.Instance.IsOpen<ChatWin>()) // { // if (((_dict != null && _dict.Count > 0) || // friendModel.tempFriendData != null) && ChatManager.Instance.PteChatID > 0) // { // requireRemind = true; // } // } // else // { // requireRemind = true; // } // } // var displayAreaHeight = m_ContainerDisplay.rect.height; // m_ContainerPrivateChatRemind.SetActive(requireRemind); // if (requireRemind) // { // displayAreaHeight = m_ContainerDisplay.rect.height - m_ContainerPrivateChatRemind.rect.height; // } // m_Scroller.sizeDelta = m_Scroller.sizeDelta.SetY(displayAreaHeight); } } float KeepArea() { if (m_ChatContentControl.GetNumberOfCells(m_ChatContentControl.m_Scorller) == ChatManager.Instance.CHAT_INFO_CNT) { var count = 0; if (m_ChatType == ChatInfoType.Friend) { var list = ChatManager.Instance.GetChatInfo(ChatManager.Instance.PteChatID); count = list == null ? 0 : list.Count; } else { var list = ChatManager.Instance.GetChatInfo(m_ChatType); count = list == null ? 0 : list.Count; } if (count == ChatManager.Instance.CHAT_INFO_CNT) { var first_size = m_ChatContentControl.GetCellSize(0); return first_size; } } return 0; } private void SoundReceiveEvent(ChatInfoType _type, int _index) { if (m_ChatType != _type) { return; } m_ChatContentControl.RefreshSingleCellView(_index); } private bool OnGetChatDynamicSize(ScrollerDataType _type, int _index, out float _height) { _height = 0; ChatData chat = null; if (m_ChatType == ChatInfoType.Friend) { var _list = ChatManager.Instance.GetChatInfo(ChatManager.Instance.PteChatID); if (_list == null || _index >= _list.Count) { return false; } chat = _list[_index]; } else { List<ChatData> _list = ChatManager.Instance.GetChatInfo(m_ChatType); if (_list == null || _index >= _list.Count) { return false; } chat = _list[_index]; } if (chat == null) { return false; } switch (_type) { case ScrollerDataType.Header: _height = m_ChatMineCell.GetHeight(chat.content, chat.infoList); return true; case ScrollerDataType.Normal: _height = m_ChatOtherCell.GetHeight(chat.content, chat.infoList); return true; case ScrollerDataType.Extra1: case ScrollerDataType.Tail: _height = 30; break; // case ScrollerDataType.Extra2: // _height = m_ChatMineVoiceCell.GetHeight(chat.content, chat.infoList); // return true; // case ScrollerDataType.Extra3: // _height = m_ChatOtherVoiceCell.GetHeight(chat.content, chat.infoList); // return true; default: return false; } OnGetChatDynamicHeight(chat.content, ref _height, _type, chat.infoList); return true; } private void OnGetChatDynamicHeight(string _content, ref float _height, ScrollerDataType _type, ArrayList _infoList) { float _textHeight = 0; if (_type == ScrollerDataType.Tail) { m_DestSysText.SetExtenalData(_infoList); m_DestSysText.text = _content; _textHeight = Mathf.Max(m_DestSysText.preferredHeight, m_DestSysText.fontSize); _height += Mathf.Max(0, _textHeight - 23); } else if (_type == ScrollerDataType.Extra1) { m_DestTipText.SetExtenalData(_infoList); m_DestTipText.text = _content; _textHeight = Mathf.Max(m_DestTipText.preferredHeight, m_DestTipText.fontSize); _height += Mathf.Max(0, _textHeight - 23); } } private void UpdateChatContent() { UpdateLockAreaState(); if (!ChatManager.Instance.lockUpdate) { chatContentControl.ResetScrollPos(); ResetNewInfo(); } } private void UpdateLockAreaState() { chatContentControl.lockType = ChatManager.Instance.lockUpdate ? EnhanceLockType.KeepVertical : EnhanceLockType.LockVerticalBottom; m_LockAreaCheck.SetActive(ChatManager.Instance.lockUpdate); } private void OnNewInfo() { if (m_ChatType != ChatInfoType.Friend) { ChatManager.Instance.lockUpdate = false; } else { JumpPteChatBottom(); } UpdateChatContent(); } private void JumpPteChatBottom() { ChatManager.Instance.lockUpdate = true; chatContentControl.lockType = EnhanceLockType.LockVerticalBottom; chatContentControl.ResetScrollPos(); ResetNewInfo(); chatContentControl.lockType = EnhanceLockType.KeepVertical; } private void OnDisable() { ChatManager.OnRefreshChat -= OnRefreshChat; ChatManager.OnRefreshPteChat -= OnRefreshPteChat; ChatManager.OnRefreshSelf -= OnRefreshSelf; ChatCenter.Instance.UpdateChatContent -= UpdateChatContent; ChatManager.Instance.OnPteChatChangeEvent -= OnPteChatChangeEvent; PlayerDatas.Instance.playerDataRefreshEvent -= PlayerDataRefreshInfoEvent; // friendModel.RefreshFriendCntEvent -= RefreshFriendCntEvent; // friendModel.RefreshFriendModel -= DisplayChatRemind; } private void RefreshFriendCntEvent(/*GroupType type, bool arg2*/) { // if (type == GroupType.RecentContact && m_ChatType == ChatInfoType.Friend) // { // DisplayChatRemind(); // if (WindowCenter.Instance.IsOpen<ChatWin>()) // { // var _dict = friendModel.GetFriendInfoDict((byte)GroupType.RecentContact); // if (!_dict.ContainsKey((uint)ChatManager.Instance.PteChatID)) // { // ChatManager.Instance.PteChatID = 0; // } // } // } } private void PlayerDataRefreshInfoEvent(PlayerDataType refreshType) { if (refreshType == PlayerDataType.ExAttr10) { m_ChatContentControl.m_Scorller.RefreshActiveCellViews(); } } } Main/System/Chat/ChatContentBehaviour.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 23701596fbb55054c8bc9a0bdc4e08f5 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/System/Chat/ChatExtraOneCell.cs
New file @@ -0,0 +1,34 @@ using vnxbqy.UI; using System.Collections; using System.Collections.Generic; using UnityEngine; using EnhancedUI.EnhancedScroller; public class ChatExtraOneCell : ScrollerUI { [SerializeField] RichText chatText; public override void Refresh(CellView cell) { ChatData _data = ChatCenter.Instance.GetChatData(ChatManager.Instance.presentChatType, cell.index); if (_data == null) { return; } if (_data.infoList != null) { chatText.SetExtenalData(_data.infoList); } chatText.text = _data.content; switch (_data.detailType) { case ChatInfoType.FairyQuestion: chatText.alignment = TextAnchor.MiddleLeft; break; default: chatText.alignment = TextAnchor.MiddleCenter; break; } } } Main/System/Chat/ChatExtraOneCell.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: b56d7af4d0244334d885f091f190b847 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/System/Chat/ChatFloatWin.cs
New file @@ -0,0 +1,157 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Tuesday, July 24, 2018 //-------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class ChatFloatWin : UIBase { [SerializeField] RectTransform m_ContainerFloat; [SerializeField] RichText m_Chat; DateTime overdueTime; ChatCenter chatCenter { get { return ChatCenter.Instance; } } protected override void OnPreOpen() { base.OnPreOpen(); m_ContainerFloat.SetActive(false); ChatManager.Instance.chatFloatUpdate += ChatFloatUpdate; UIManager.Instance.OnOpenWindow += OnOpenWindow; } protected override void OnOpen() { base.OnOpen(); } protected override void OnPreClose() { ChatManager.Instance.chatFloatUpdate -= ChatFloatUpdate; UIManager.Instance.OnOpenWindow -= OnOpenWindow; } protected override void OnClose() { base.OnClose(); } protected void LateUpdate() { if (DateTime.Now > overdueTime && m_ContainerFloat.gameObject.activeSelf) { m_ContainerFloat.SetActive(false); } } void OnOpenWindow(UIBase window) { if (window is MainWin || window is LoadingWin/* || window is TreasureBaseWin*/) { m_ContainerFloat.SetActive(false); } } private void ChatFloatUpdate(ChatData data) { if (!chatCenter.IsShowChatFloat()) { return; } if (data == null) { return; } if (string.IsNullOrEmpty(data.content)) { return; } switch (data.type) { case ChatInfoType.Friend: case ChatInfoType.FairyQuestion: case ChatInfoType.FairyTip: case ChatInfoType.TeamTip: case ChatInfoType.default2: return; } m_ContainerFloat.SetActive(true); m_Chat.text = string.Empty; overdueTime = DateTime.Now.AddTicks(3 * TimeSpan.TicksPerSecond); if (data.infoList != null) { m_Chat.SetExtenalData(data.infoList); } Co_SetText(StringUtility.Contact(SetChatExtraInfo(data), data.content)); } void Co_SetText(string value) { m_Chat.text = value; if (m_Chat.preferredWidth >= 1000) { m_Chat.alignment = TextAnchor.MiddleLeft; } else { m_Chat.alignment = TextAnchor.MiddleCenter; } } string SetChatExtraInfo(ChatData data) { switch (data.type) { case ChatInfoType.World: { return string.Format("<Img chat={0}/> <color=#109d06>{1}</color>: ", "ChatIcon_World", (data as ChatUeseData).name); } case ChatInfoType.Area: return string.Format("<Img chat={0}/> <color=#109d06>{1}</color>: ", "ChatIcon_Area", (data as ChatUeseData).name); case ChatInfoType.CrossServer: return string.Format("<Img chat={0}/> <color=#109d06>{1}</color>: ", "ChatIcon_CrossServer", (data as ChatUeseData).name); case ChatInfoType.Team: { string playerName = (data as ChatUeseData).name; return string.Format("<Img chat={0}/> <color=#109d06>{1}</color>", "ChatIcon_Team", playerName + (playerName != string.Empty ? ": " : string.Empty)); } case ChatInfoType.Friend: break; case ChatInfoType.Fairy: { string playerName = (data as ChatUeseData).name; return string.Format("<Img chat={0}/> <color=#109d06>{1}</color>", "ChatIcon_Fairy", playerName + (playerName != string.Empty ? ": " : string.Empty)); } // case ChatInfoType.Trumpet: // return string.Format("<Img chat={0}/> <color=#109d06>{1}</color>: ", "ChatIcon_Trumpet", (data as ChatTrumpetData).name); case ChatInfoType.Invite: return string.Format("<Img chat={0}/> ", "ChatIcon_Invite"); case ChatInfoType.System: return string.Format("<Img chat={0}/> ", "ChatIcon_System"); case ChatInfoType.default1: return string.Format("<Img chat={0}/> <color=#109d06>{1}</color>: ", "ChatIcon_default1", (data as ChatUeseData).name); } return string.Empty; } } Main/System/Chat/ChatFloatWin.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: e77bfce9b34f5aa459bbe14732a6dab6 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/System/Chat/ChatPlayerMineCell.cs
New file @@ -0,0 +1,71 @@ using System.Collections; using UnityEngine; using UnityEngine.UI; using EnhancedUI.EnhancedScroller; public class ChatPlayerMineCell : ScrollerUI { // [SerializeField] AvatarCell avatarCell; [SerializeField] RectTransform m_avatarRect; [SerializeField] Text m_VipLv; [SerializeField] Text m_PlayerName; [SerializeField] Text m_ChatTime; [SerializeField] ChatBubbleBehaviour m_ChatBubble; [SerializeField] float spacing = 5.0f; // PhantasmPavilionModel phantasmPavilionModel { get { return ModelCenter.Instance.GetModel<PhantasmPavilionModel>(); } } public override void Refresh(CellView cell) { ChatData data = ChatCenter.Instance.GetChatData(ChatManager.Instance.presentChatType, cell.index); if (data == null) { return; } var chatUserData = data as ChatUeseData; m_ChatBubble.DisplayContent(data.content); // TODO YYL // int bubbleID = phantasmPavilionModel.GetNowChatBubbleID(); // m_ChatBubble.DisplayBubble(bubbleID); // avatarCell.InitUI(AvatarHelper.GetMyAvatarModel()); // avatarCell.button.SetListener(() => // { // OnFunc(cell); // }); m_PlayerName.text = chatUserData.name; m_ChatTime.text = data.createTime.ToString("yyyy-MM-dd HH:mm"); if (chatUserData.vipLv > 0) { m_VipLv.text = "VIP";//string.Format("V{0}", chatUserData.vipLv); } else { m_VipLv.text = string.Empty; } } private void OnFunc(CellView cell) { int index = cell.index; ChatData _data = ChatCenter.Instance.GetChatData(ChatManager.Instance.presentChatType, index); if (_data == null) { return; } ChatUeseData user = _data as ChatUeseData; if (user.player == PlayerDatas.Instance.baseData.PlayerID) { return; } HrefAnalysis.Inst.ExcuteHrefEvent(string.Format("<a>showplayer={0}</a>", user.player)); } public float GetHeight(string content, ArrayList list) { var minHeight = m_avatarRect.sizeDelta.y; var chatHeight = m_ChatBubble.GetBubbleHeight(content, list) + Mathf.Abs(m_ChatBubble.transform.localPosition.y); return (chatHeight > minHeight ? chatHeight : minHeight) + spacing; } } Main/System/Chat/ChatPlayerMineCell.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 7ee004d14ee4b6643979cdb48794316e MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/System/Chat/ChatPlayerOtherCell.cs
New file @@ -0,0 +1,81 @@ using System.Collections; using UnityEngine; using UnityEngine.UI; using EnhancedUI.EnhancedScroller; public class ChatPlayerOtherCell : ScrollerUI { // [SerializeField] AvatarCell avatarCell; [SerializeField] RectTransform m_avatarRect; [SerializeField] Text m_VipLv; [SerializeField] Text m_PlayerName; [SerializeField] Text m_ChatTime; [SerializeField] ChatBubbleBehaviour m_ChatBubble; [SerializeField] float spacing = 5.0f; // PhantasmPavilionModel phantasmPavilionModel { get { return ModelCenter.Instance.GetModel<PhantasmPavilionModel>(); } } public override void Refresh(CellView cell) { var data = ChatCenter.Instance.GetChatData(ChatManager.Instance.presentChatType, cell.index); if (data == null) { return; } var chatUserData = data as ChatUeseData; // AvatarModel avatarModel = AvatarHelper.GetOtherAvatarModel(chatUserData.face, chatUserData.facePic, chatUserData.job); // avatarCell.InitUI(avatarModel); // avatarCell.button.SetListener(() => // { // OnFunc(cell); // }); m_PlayerName.text = chatUserData.name; m_ChatTime.text = data.createTime.ToString("yyyy-MM-dd HH:mm"); if (chatUserData.vipLv > 0) { m_VipLv.text = "VIP";//string.Format("V{0}", chatUserData.vipLv); } else { m_VipLv.text = string.Empty; } m_ChatBubble.DisplayContent(data.content, true); // int bubbleID = phantasmPavilionModel.GetNowOtherChatBubbleID(chatUserData.bubbleId); // m_ChatBubble.DisplayBubble(bubbleID); } private void OnFunc(CellView cell) { int index = cell.index; ChatData _data = ChatCenter.Instance.GetChatData(ChatManager.Instance.presentChatType, index); if (_data == null) { return; } ChatUeseData user = _data as ChatUeseData; if (user.player == PlayerDatas.Instance.baseData.PlayerID) { return; } if (user.serverGroupId == 0 || user.serverGroupId == PlayerDatas.Instance.baseData.ServerGroupId) { // TODO YYL // PlayerDetails.ShowPlayerDetails(user.player, null); } else { // TODO YYL // PlayerDetails.ShowCrossServerChatPlayer(user); } } public float GetHeight(string content, ArrayList list) { var minHeight = m_avatarRect.sizeDelta.y; var chatHeight = m_ChatBubble.GetBubbleHeight(content, list) + Mathf.Abs(m_ChatBubble.transform.localPosition.y); return (chatHeight > minHeight ? chatHeight : minHeight) + spacing; } } Main/System/Chat/ChatPlayerOtherCell.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: bedfc9050fc3f5d478a3aee50ce944a5 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/System/Chat/ChatRecently.cs
New file @@ -0,0 +1,108 @@ using System; using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; public class ChatRecently : MonoBehaviour { [SerializeField] ScrollerController m_RecentlyControl; // FriendsModel m_FriendModel; // FriendsModel friendModel // { // get // { // return m_FriendModel ?? (m_FriendModel = ModelCenter.Instance.GetModel<FriendsModel>()); // } // } private void OnEnable() { UpdatePlayer(); DisplayRecently(); // friendModel.RefreshFriendCntEvent += RefreshFriendCntEvent; // friendModel.RefreshFriendModel += DisplayRecently; } private void OnDisable() { // friendModel.RefreshFriendCntEvent -= RefreshFriendCntEvent; // friendModel.RefreshFriendModel -= DisplayRecently; } private void DisplayRecently() { m_RecentlyControl.Refresh(); // var _dict = friendModel.GetFriendInfoDict((byte)GroupType.RecentContact); // if (_dict != null) // { // if (friendModel.tempFriendData != null && !_dict.ContainsKey(friendModel.tempFriendData.PlayerID)) // { // m_RecentlyControl.AddCell(ScrollerDataType.Header, (int)friendModel.tempFriendData.PlayerID, OnClickFriend); // } // foreach (var _id in _dict.Keys) // { // m_RecentlyControl.AddCell(ScrollerDataType.Header, (int)_id, OnClickFriend); // } // } // else if (friendModel.tempFriendData != null) // { // m_RecentlyControl.AddCell(ScrollerDataType.Header, (int)friendModel.tempFriendData.PlayerID, OnClickFriend); // } m_RecentlyControl.Restart(); } private void OnClickFriend(CellView _cell) { // if(_cell.index!= ChatManager.Instance.PteChatID) // { // ChatManager.Instance.PteChatID = _cell.index; // var _dict = friendModel.GetFriendInfoDict((byte)GroupType.RecentContact); // if (friendModel.tempFriendData != null // && ChatManager.Instance.PteChatID == friendModel.tempFriendData.PlayerID) // { // ChatManager.Instance.PteChatName = friendModel.tempFriendData.PlayerName; // LanguageVerify.toPlayerLevel = friendModel.tempFriendData.LV; // } // else // { // ChatManager.Instance.PteChatName = _dict != null && _dict.ContainsKey((uint)ChatManager.Instance.PteChatID) ? // _dict[(uint)ChatManager.Instance.PteChatID].PlayerName : string.Empty; // LanguageVerify.toPlayerLevel = _dict != null && _dict.ContainsKey((uint)ChatManager.Instance.PteChatID) ? // _dict[(uint)ChatManager.Instance.PteChatID].LV : 0; // } // ChatManager.Instance.SelectRecentlyChat(ChatManager.Instance.PteChatID); // m_RecentlyControl.m_Scorller.RefreshActiveCellViews(); // } } private void RefreshFriendCntEvent(/*GroupType _type, bool arg2*/) { // if (_type == GroupType.RecentContact) // { // DisplayRecently(); // } } private void UpdatePlayer() { // TODO YYL // if (friendModel.tempFriendData != null) // { // ChatManager.Instance.PteChatID = (int)friendModel.tempFriendData.PlayerID; // ChatManager.Instance.PteChatName = friendModel.tempFriendData.PlayerName; // LanguageVerify.toPlayerLevel = friendModel.tempFriendData.LV; // ChatManager.Instance.SelectRecentlyChat(ChatManager.Instance.PteChatID); // return; // } // var _dict = friendModel.GetFriendInfoDict((byte)GroupType.RecentContact); // if (_dict != null && _dict.Count > 0) // { // ChatManager.Instance.PteChatID = (int)_dict.Keys.First(); // ChatManager.Instance.PteChatName = _dict[(uint)ChatManager.Instance.PteChatID].PlayerName; // LanguageVerify.toPlayerLevel = _dict[(uint)ChatManager.Instance.PteChatID].LV; // ChatManager.Instance.SelectRecentlyChat(ChatManager.Instance.PteChatID); // } } } Main/System/Chat/ChatRecently.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: b7daa7a18d7fb904ead12815d531a9df MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/System/Chat/ChatRecentlyCell.cs
New file @@ -0,0 +1,58 @@ using vnxbqy.UI; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using EnhancedUI.EnhancedScroller; public class ChatRecentlyCell : ScrollerUI { [SerializeField] Image m_PlayerBG; [SerializeField] Image m_Select; [SerializeField] Text m_PlayerName; [SerializeField] Text m_Lv; [SerializeField] Image m_LvSign; [SerializeField] Text m_LvText; [SerializeField] Button m_DetailBtn; public override void Refresh(CellView cell) { // TODO YYL // var _playerId = cell.index; // var _dict = friendModel.GetFriendInfoDict((byte)GroupType.RecentContact); // FriendPlayer _friendPlayer = null; // if (_dict != null && _dict.ContainsKey((uint)_playerId)) // { // _friendPlayer = _dict[(uint)_playerId]; // } // else if (friendModel.tempFriendData != null && friendModel.tempFriendData.PlayerID == _playerId) // { // _friendPlayer = friendModel.tempFriendData; // } // if (_friendPlayer == null) // { // return; // } // m_Select.SetActive(_playerId == ChatCtrl.Inst.PteChatID); // m_PlayerName.text = _friendPlayer.PlayerName; // m_LvSign.SetActive(false); // var _lv = _friendPlayer.LV ; // m_LvText.text = (_lv > 0 ? _lv : _friendPlayer.LV).ToString(); // m_DetailBtn.onClick.RemoveAllListeners(); // m_DetailBtn.onClick.AddListener(() => // { // PlayerDetails.ShowPlayerDetails(_playerId, null); // }); // SetOnline(_friendPlayer.OnlineType == 1); } private void SetOnline(bool _online) { m_PlayerBG.material = _online ? MaterialUtility.GetUIDefaultGraphicMaterial() : MaterialUtility.GetDefaultSpriteGrayMaterial(); m_LvSign.material = _online ? MaterialUtility.GetUIDefaultGraphicMaterial() : MaterialUtility.GetDefaultSpriteGrayMaterial(); m_Lv.color = _online ? UIHelper.GetUIColor(TextColType.NavyBrown) : UIHelper.GetUIColor(TextColType.White, true); m_LvText.color = _online ? UIHelper.GetUIColor(TextColType.NavyBrown) : UIHelper.GetUIColor(TextColType.White, true); m_PlayerName.color = _online ? UIHelper.GetUIColor(TextColType.NavyBrown) : UIHelper.GetUIColor(TextColType.White, true); } } Main/System/Chat/ChatRecentlyCell.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 0f8061f41da2e504db0e4b0a742928df MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/System/Chat/ChatSendComponent.cs
New file @@ -0,0 +1,480 @@ using System; using System.Collections; using System.Collections.Generic; using System.Text.RegularExpressions; using UnityEngine; using UnityEngine.UI; using Cysharp.Threading.Tasks; public class ChatSendComponent : MonoBehaviour { [SerializeField] Button m_SendBtn; [SerializeField] InputField m_ChatInput; [SerializeField] Button m_ExtentBtn; // [SerializeField] VoiceRecorder m_VoiceRecorder; [SerializeField] RichText m_ChatValueDisplay; [SerializeField] Text m_Placeholder; [SerializeField, Header("上移高度")] float m_UpHeight = 300.0f; public Text placeholder { get { return m_Placeholder; } } public Button sendBtn { get { return m_SendBtn; } } // PhantasmPavilionModel phantasmPavilionModel { get { return ModelCenter.Instance.GetModel<PhantasmPavilionModel>(); } } // VipModel vipModel { get { return ModelCenter.Instance.GetModel<VipModel>(); } } // [NonSerialized] public UIBase parent; private bool m_OnChating = false; private void Awake() { m_SendBtn.onClick.AddListener(OnChatSend); m_ExtentBtn.onClick.AddListener(OnExtent); m_ChatInput.onValueChanged.AddListener(OnChatValueChange); } private void OnEnable() { // m_VoiceRecorder.voiceRecordSuccessEvent += OnVoiceRecordSuccessEvent; FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChangeEvent; ChatCenter.Instance.UpdateChatValueEvent += UpdateChatValueEvent; ChatCenter.Instance.UpdateChatType += UpdateChatType; m_ChatInput.characterLimit = ChatCenter.Instance.chatCharacterLimit; // WindowCenter.Instance.windowAfterCloseEvent += WindowAfterCloseEvent; // phantasmPavilionModel.SendChatAction += OnSendChatAction; m_OnChating = false; } private void OnDisable() { // m_VoiceRecorder.voiceRecordSuccessEvent -= OnVoiceRecordSuccessEvent; FuncOpen.Instance.OnFuncStateChangeEvent -= OnFuncStateChangeEvent; ChatCenter.Instance.UpdateChatValueEvent -= UpdateChatValueEvent; ChatCenter.Instance.UpdateChatType -= UpdateChatType; // WindowCenter.Instance.windowAfterCloseEvent -= WindowAfterCloseEvent; // phantasmPavilionModel.SendChatAction -= OnSendChatAction; } // private void WindowAfterCloseEvent(Window _window) // { // if (_window is ChatExtentWin) // { // if (parent != null) // { // parent.transform.localPosition = parent.transform.localPosition.SetY(0); // } // } // } private void LateUpdate() { } private void UpdateChatType() { m_Placeholder.text = ChatManager.Instance.presentChatType == ChatInfoType.Trumpet ? Language.Get("L1012") : Language.Get("L1111"); } bool ChangeBranch() { if (m_ChatInput.text.StartsWith("#@#BrancH")) { if (m_ChatInput.text.Split(' ')[1] == "c") { //删除记录 LocalSave.DeleteKey("#@#BrancH"); ScrollTip.ShowTip("清理分支设置"); } else { //切换分支 LocalSave.SetString("#@#BrancH", m_ChatInput.text.Split(' ')[1]); ScrollTip.ShowTip("分支设置完毕"); } return true; } return false; } private void OnChatSend() { if (ChangeBranch()) return; if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Chat)) { FuncOpen.Instance.ProcessorFuncErrorTip((int)FuncOpenEnum.Chat); return; } // TODO YYL // if (vipModel.realRecharge < ChatCenter.Instance.talkRechargeLimmit || // PlayerDatas.Instance.baseData.LV < ChatCenter.Instance.talkLevelLimmit) // { // SysNotifyMgr.Instance.ShowTip("mdtqInfo1", ChatCenter.Instance.talkRechargeLimmit, ChatCenter.Instance.talkLevelLimmit); // return; // } if (ChatManager.Instance.presentChatType == ChatInfoType.CrossServer) { if (!FuncOpen.Instance.IsFuncOpen(162)) { SysNotifyMgr.Instance.ShowTip("CrossServerHint"); return; } } ChatExtraData? info = null; SinglePack singlePack = PackManager.Instance.GetSinglePack(PackType.Item); if (ChatManager.Instance.presentChatType == ChatInfoType.Trumpet) { if (ChatCenter.Instance.IsChatBanned || ChatCenter.Instance.clientBanned) { return; } var count = singlePack.GetCountById(ChatCenter.Instance.bugleItem); if (count < 1) { ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), Language.Get("NoTrumpet"), () => { // TODO YYL // WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.StoreFunc2); }); return; } var items = singlePack.GetItemsById(ChatCenter.Instance.bugleItem); info = new ChatExtraData() { infoint1 = items[0].gridIndex }; } if (m_ChatInput.text.Length < 1) { return; } if (m_OnChating) { return; } if (CheckChatCD()) { SysNotifyMgr.Instance.ShowTip("OnChatCD"); return; } if (!ChatCenter.Instance.clientBanned) { CheckRepeatContent(m_ChatInput.text); CheckMaliceChat(m_ChatInput.text); } m_OnChating = true; string msg = m_ChatInput.text; string tmpMsg = ImgAnalysis.ReplaceFace(msg, out int faceCount); if (DirtyWordConfig.IsDirtWord(tmpMsg)) { tmpMsg = DirtyWordConfig.IsDirtWord(tmpMsg, '*'); tmpMsg = tmpMsg.Replace("*", ""); m_ChatInput.text = tmpMsg; SysNotifyMgr.Instance.ShowTip("DirtyWordWarn"); m_OnChating = false; return; } ChatManager.Instance.SendChatInfo(ChatManager.Instance.presentChatType, msg, info, false); StartCoroutine(Co_CoolDowmChat()); // TODO YYL // ModelCenter.Instance.GetModel<FirstTimeRechargeModel>().AskFirstRechargeMore(msg); } private void OnChatSend(string msg) { if (ChangeBranch()) return; if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Chat)) { FuncOpen.Instance.ProcessorFuncErrorTip((int)FuncOpenEnum.Chat); return; } if (ChatManager.Instance.presentChatType == ChatInfoType.CrossServer) { if (!FuncOpen.Instance.IsFuncOpen(162)) { SysNotifyMgr.Instance.ShowTip("CrossServerHint"); return; } } ChatExtraData? info = null; SinglePack singlePack = PackManager.Instance.GetSinglePack(PackType.Item); if (ChatManager.Instance.presentChatType == ChatInfoType.Trumpet) { if (ChatCenter.Instance.IsChatBanned || ChatCenter.Instance.clientBanned) { return; } var count = singlePack.GetCountById(ChatCenter.Instance.bugleItem); if (count < 1) { ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), Language.Get("NoTrumpet"), () => { // TODO YYL // WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.StoreFunc2); }); return; } var items = singlePack.GetItemsById(ChatCenter.Instance.bugleItem); info = new ChatExtraData() { infoint1 = items[0].gridIndex }; } if (msg.Length < 1) { return; } if (m_OnChating) { return; } if (CheckChatCD()) { SysNotifyMgr.Instance.ShowTip("OnChatCD"); return; } if (!ChatCenter.Instance.clientBanned) { CheckRepeatContent(msg); CheckMaliceChat(msg); } m_OnChating = true; ChatManager.Instance.SendChatInfo(ChatManager.Instance.presentChatType, msg, info, false); StartCoroutine(Co_CoolDowmChat()); } IEnumerator Co_CoolDowmChat() { yield return new WaitForSeconds(1.5f); // yield return WaitingForSecondConst.WaitMS1500; m_OnChating = false; } private void OnChatValueChange(string _msg) { string _chat = Regex.Replace(_msg, @"\p{Cs}|&", ""); if (!_chat.Equals(_msg)) { m_ChatInput.text = _chat; ChatCenter.Instance.chatInputLength = m_ChatInput.text.Length; } if (_msg.Equals(string.Empty)) { ChatCenter.Instance.recentlyChat = null; } m_ChatValueDisplay.text = _chat; MatchCollection matchArray = HrefAnalysis.EquipRegex.Matches(_chat); if (matchArray.Count == 0) { ChatManager.Instance.itemPlaceList.Clear(); ChatCenter.Instance.recentlyChat = null; return; } if (ChatCenter.Instance.recentlyChat == null) { if (ChatManager.Instance.itemPlaceList.Count == matchArray.Count) { return; } } if (ChatCenter.Instance.recentlyChat != null) { var _recentlyChat = ChatCenter.Instance.recentlyChat; for (int i = 0, m = 0; i < _recentlyChat.itemIndexs.Count; i++) { if (m < matchArray.Count) { Match match = matchArray[m]; if (_recentlyChat.itemNames[_recentlyChat.itemIndexs[i]] != match.Groups[1].Value) { _recentlyChat.itemIndexs.RemoveAt(i); i--; } else { m++; } } } return; } for (int i = 0, m = 0; i < ChatManager.Instance.itemPlaceList.Count; i++) { if (m < matchArray.Count) { Match match = matchArray[m]; ItemModel itemModel = ChatManager.Instance.itemPlaceList[i]; ItemConfig cfg = ItemConfig.Get((int)itemModel.itemId); if (cfg.ItemName != match.Groups[1].Value) { ChatManager.Instance.itemPlaceList.RemoveAt(i); i--; } else { m++; } } } } private void UpdateChatValueEvent(string _msg, bool _add, bool _force) { if (_add) { m_ChatInput.text += _msg; ChatCenter.Instance.chatInputLength = m_ChatInput.text.Length; } else { m_ChatInput.text = _msg; ChatCenter.Instance.chatInputLength = m_ChatInput.text.Length; } } private void OnExtent() { // if (!WindowCenter.Instance.IsOpen<ChatExtentWin>()) // { // WindowCenter.Instance.Open<ChatExtentWin>(true); // if (parent != null) // { // parent.transform.localPosition = parent.transform.localPosition.SetY(m_UpHeight); // } // } // else // { // WindowCenter.Instance.Close<ChatExtentWin>(); // if (parent != null) // { // parent.transform.localPosition = parent.transform.localPosition.SetY(0); // } // } } // private void OnVoiceRecordSuccessEvent(int _instance, float _length) // { // var _type = ChatManager.Instance.presentChatType; // ChatCenter.Instance.SetVoice(_instance, _type, _length, _type == ChatInfoType.Friend ? ChatManager.Instance.PteChatID : 0); // } private void OnFuncStateChangeEvent(int _id) { if (_id == (int)FuncOpenEnum.Chat) { } } #region 恶意发言 static string repeatChatContent = string.Empty; static int repeatChatCount = 0; static DateTime repeatTime = DateTime.Now; private void CheckRepeatContent(string _content) { if (ChatManager.Instance.IsAssitChat(_content, true) == 0 && repeatChatContent.Equals(_content) && (TimeUtility.ServerNow - repeatTime).TotalSeconds < ChatCenter.Instance.banCheckSecond) { repeatChatCount++; if (repeatChatCount >= ChatCenter.Instance.repeatCountLimit) { Co_ClientBan().Forget(); } } else { repeatChatContent = _content; repeatChatCount = 1; repeatTime = TimeUtility.ServerNow; } } static int maliceChatCount = 0; static int maliceRecordCount = 0; static DateTime maliceChatTime = DateTime.Now; private void CheckMaliceChat(string _content) { if ((TimeUtility.ServerNow - maliceChatTime).TotalSeconds < ChatCenter.Instance.banCheckSecond && maliceChatCount > 0 && maliceRecordCount < ChatCenter.Instance.maliceCheckCount) { maliceRecordCount++; if (ChatManager.GetUTF8InfoLen(_content) == 1) { maliceChatCount++; } if (maliceChatCount >= ChatCenter.Instance.maliceLimitCount) { Co_ClientBan().Forget(); } } else { if (ChatManager.GetUTF8InfoLen(_content) == 1) { maliceChatCount = 1; maliceRecordCount = 1; maliceChatTime = TimeUtility.ServerNow; } else { maliceChatCount = 0; maliceRecordCount = 0; } } } async UniTask Co_ClientBan() { await UniTask.Yield(); ChatCenter.Instance.ChatClientBan(); } #endregion #region 聊天CD private DateTime chatCdTime = DateTime.Now; private int chatCdCount = 0; private bool chatBusy = false; public bool CheckChatCD() { if (chatBusy && (DateTime.Now - chatCdTime).TotalSeconds < 10) { return true; } else if (chatBusy) { chatBusy = false; chatCdCount = 0; } if ((DateTime.Now - chatCdTime).TotalSeconds < 2) { chatCdCount++; } else { chatCdCount = 1; } if (chatCdCount > 5) { chatBusy = true; return true; } chatCdTime = DateTime.Now; return false; } #endregion private void OnSendChatAction(string msg) { OnChatSend(msg); // WindowCenter.Instance.Close<ChatExtentWin>(); // if (parent != null) // { // parent.transform.localPosition = parent.transform.localPosition.SetY(0); // } } } Main/System/Chat/ChatSendComponent.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 58d9b99b8e7b0214188aa4ce9bb60c51 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/System/Chat/ChatTrailCell.cs
New file @@ -0,0 +1,43 @@ using vnxbqy.UI; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using EnhancedUI.EnhancedScroller; public class ChatTrailCell : ScrollerUI { [SerializeField] Image chatIcon; [SerializeField] RichText chatText; public override void Refresh(CellView cell) { ChatData _data = ChatCenter.Instance.GetChatData(ChatManager.Instance.presentChatType, cell.index); if (_data == null) { return; } if (_data.infoList != null) { chatText.SetExtenalData(_data.infoList); } chatIcon.SetActive(true); if (_data.type == ChatInfoType.Invite) { chatIcon.SetSprite("ChatIcon_Invite"); } else if (_data.type == ChatInfoType.System) { chatIcon.SetSprite("ChatIcon_System"); } else if (_data.type == ChatInfoType.Friend) { chatIcon.SetSprite("ChatIcon_System"); } else { chatIcon.SetActive(false); } chatText.text = _data.type == ChatInfoType.Friend ? _data.content.Replace(ChatManager.KILL_IDENTIFY, string.Empty) : _data.content; } } Main/System/Chat/ChatTrailCell.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 1835916648a9e5948aa8d92a884bbf1c MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/System/Chat/ChatWin.cs
New file @@ -0,0 +1,285 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Monday, April 09, 2018 //-------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class ChatWin : UIBase { [SerializeField] Button m_CloseBtn; [SerializeField] Text m_ChatTip; [SerializeField] ChatSendComponent m_ChatSend; [SerializeField] ScrollerController m_ChannelControl; [SerializeField] ChatContentBehaviour m_ChatContent; [SerializeField] ChatRecently m_ChatRecently; [SerializeField] Button m_ChannelBtn; [SerializeField] Text m_ChannelInfo; protected override void InitComponent() { m_CloseBtn.onClick.AddListener(OnClose); m_ChannelBtn.onClick.AddListener(OnChannelBtn); } protected override void OnPreOpen() { if (!IsSatisfyShowChannel(ChatManager.Instance.presentChatType)) { ChatManager.Instance.presentChatType = ChatInfoType.System; } // m_ChatSend.parent = this; ChatManager.Instance.lockUpdate = false; ChatManager.Instance.OnPteChatChangeEvent += OnPteChatChangeEvent; ChatManager.Instance.OpenPteChatEvent += OpenPteChatEvent; DisplayChannel(); OnChatTypeChange(); ChatCenter.Instance.UpdateChatContentPos(); } protected override void OnOpen() { AchievementRandomWord(); if (ChatManager.Instance.openFromDaily) { AssitRandomChat(); ChatManager.Instance.needCheckAssitChat = true; } else if (ChatManager.Instance.openFromGem) { string chat = Language.Get("ThanksGift" + UnityEngine.Random.Range(1, 4)); if (chat != string.Empty) { ChatCenter.Instance.ChangeChatValue(chat, false, true); } } else if (ChatManager.Instance.openFromFairyTask) { TaskRandomChat(); } ChatManager.Instance.openFromDaily = false; ChatManager.Instance.openFromGem = false; ChatManager.Instance.openFromFairyTask = false; } protected override void OnPreClose() { ChatManager.Instance.OnPteChatChangeEvent -= OnPteChatChangeEvent; ChatManager.Instance.OpenPteChatEvent -= OpenPteChatEvent; ChatManager.Instance.openFromDaily = false; ChatManager.Instance.openFromGem = false; ChatManager.Instance.needCheckAssitChat = false; ChatManager.Instance.openFromFairyTask = false; //ChatCenter.Instance.ChangeChatValue(string.Empty, false, true); //ChatManager.Instance.itemPlaceList.Clear(); } protected override void OnClose() { } private void OpenPteChatEvent() { OnChannelSelect(ChatInfoType.Friend); } private void DisplayChannel() { m_ChannelControl.Refresh(); for (int i = 0; i < ChatCenter.Instance.chatChannels.Count; i++) { if (IsSatisfyShowChannel(ChatCenter.Instance.chatChannels[i])) { m_ChannelControl.AddCell(ScrollerDataType.Normal, (int)ChatCenter.Instance.chatChannels[i], OnChannelSelect); } } m_ChannelControl.Restart(); m_ChannelControl.JumpIndex(Math.Min((int)ChatManager.Instance.presentChatType, m_ChannelControl.GetNumberOfCells(m_ChannelControl.m_Scorller) - 1)); } private bool IsSatisfyShowChannel(ChatInfoType channel) { if (CrossServerUtility.IsCrossServer()) { if (channel == ChatInfoType.Team || channel == ChatInfoType.Invite) { return false; } } return true; } private void OnPteChatChangeEvent() { if (ChatManager.Instance.presentChatType == ChatInfoType.Friend) { OnChatTypeChange(); } } private void OnChatTypeChange() { m_ChannelBtn.SetActive(false); m_ChannelInfo.SetActive(false); m_ChatSend.placeholder.text= Language.Get("L1111"); m_CloseBtn.SetActive(ChatManager.Instance.presentChatType != ChatInfoType.Friend); switch (ChatManager.Instance.presentChatType) { case ChatInfoType.Trumpet: m_ChatRecently.SetActive(false); m_ChatTip.SetActive(false); m_ChatSend.SetActive(true); m_ChatSend.placeholder.text = Language.Get("L1012"); break; case ChatInfoType.Invite: case ChatInfoType.System: m_ChatRecently.SetActive(false); m_ChatTip.text = Language.Get("L1109"); m_ChatTip.SetActive(true); m_ChatSend.SetActive(false); break; case ChatInfoType.World: case ChatInfoType.Area: case ChatInfoType.CrossServer: case ChatInfoType.default1: m_ChatRecently.SetActive(false); m_ChatTip.SetActive(false); m_ChatSend.SetActive(true); break; case ChatInfoType.Team: // TODO YYL // m_ChatRecently.SetActive(false); // var _team = ModelCenter.Instance.GetModel<TeamModel>().myTeam; // m_ChatSend.SetActive(_team.teamId > 0); // m_ChatTip.SetActive(_team.teamId <= 0); // m_ChatTip.text = Language.Get("L1110"); break; case ChatInfoType.Fairy: // TODO YYL // m_ChatRecently.SetActive(false); // m_ChannelBtn.SetActive(!PlayerDatas.Instance.fairyData.HasFairy); // m_ChannelInfo.SetActive(!PlayerDatas.Instance.fairyData.HasFairy); // m_ChatTip.SetActive(!PlayerDatas.Instance.fairyData.HasFairy); // m_ChatSend.SetActive(PlayerDatas.Instance.fairyData.HasFairy); // if (!PlayerDatas.Instance.fairyData.HasFairy) // { // m_ChatTip.text = Language.Get("L1011"); // } break; case ChatInfoType.Friend: m_ChatSend.SetActive(true); m_ChatTip.SetActive(false); if (!m_ChatRecently.gameObject.activeSelf) { m_ChatRecently.SetActive(true); } break; } m_ChatContent.chatType = ChatManager.Instance.presentChatType; ChatManager.Instance.ViewChat(ChatManager.Instance.presentChatType); } private void OnChannelSelect(CellView _cell) { if ((ChatInfoType)_cell.index == ChatInfoType.CrossServer) { if (!FuncOpen.Instance.IsFuncOpen(162)) { SysNotifyMgr.Instance.ShowTip("CrossServerHint"); return; } } OnChannelSelect((ChatInfoType)_cell.index); } private void OnChannelSelect(ChatInfoType _type) { ChatManager.Instance.presentChatType = _type; m_ChannelControl.m_Scorller.RefreshActiveCellViews(); if (_type == ChatInfoType.Friend) { ChatManager.Instance.lockUpdate = true; } else { ChatManager.Instance.lockUpdate = false; } OnChatTypeChange(); ChatCenter.Instance.UpdateChatContentPos(); } private void OnChannelBtn() { switch (ChatManager.Instance.presentChatType) { case ChatInfoType.Fairy: { int limit = FuncOpenLVConfig.Get((int)FuncOpenEnum.Fairy).LimitLV; if (PlayerDatas.Instance.baseData.LV < limit) { ServerTipDetails.DisplayNormalTip(Language.Get("L1136", limit)); return; } CloseWindow(); // TODO YYL // WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.UnionFunc3); } break; } } private void AchievementRandomWord() { // TODO YYL // if (AchievementGoto.achievementType != AchievementGoto.RandomFairyChat // && AchievementGoto.achievementType != AchievementGoto.RandomWorldChat) // { // return; // } // AchievementGoto.achievementType = 0; // if (AchievementGoto.achievementType == AchievementGoto.RandomFairyChat && !PlayerDatas.Instance.fairyData.HasFairy) // { // return; // } // if (ChatManager.Instance.achievementRandoms.ContainsKey(ChatManager.Instance.presentChatType)) // { // var _list = ChatManager.Instance.achievementRandoms[ChatManager.Instance.presentChatType]; // int _index = UnityEngine.Random.Range(0, _list.Count); // ChatCenter.Instance.ChangeChatValue(Language.Get(_list[_index]), false, true); // } // var _effect = AchievementGuideEffectPool.Require(1); // _effect.transform.SetParentEx(m_ChatSend.sendBtn.transform, Vector3.zero, Vector3.zero, Vector3.one); } private void AssitRandomChat() { ChatCenter.Instance.ChangeChatValue(ChatManager.Instance.GetAssitRandomChat(ChatManager.Instance.presentChatType), false, true); } private void TaskRandomChat() { ChatCenter.Instance.ChangeChatValue(ChatManager.Instance.GetTaskRandomChat(ChatManager.Instance.presentChatType), false, true); } private void GemFlauntChat() { // TODO YYL // ChatCenter.Instance.ChangeChatValue(ChatManager.Instance.GetGemFlauntChat(), false, true); // var _effect = AchievementGuideEffectPool.Require(1); // _effect.transform.SetParentEx(m_ChatSend.sendBtn.transform, Vector3.zero, Vector3.zero, Vector3.one); } } Main/System/Chat/ChatWin.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: cb479f4f9ab863f40a42a46fffad01c5 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/System/ClientVersion/VersionUpdateWin.cs
@@ -36,8 +36,7 @@ { base.OnOpen(); // 窗口打开时的逻辑 // TODO YYL m_Info.text = string.Empty;//Language.GetFromLocal(9); m_Info.text = Language.GetFromLocal(9); } protected override void OnClose() Main/System/CrossServer/CrossServerUtility.cs
@@ -55,8 +55,8 @@ public static bool IsCrossServerBoss() { // TODO YYL // if (PlayerDatas.Instance.baseData.CrossServerFlag <= 2) // return false; if (PlayerDatas.Instance.baseData.CrossServerFlag <= 2) return false; // return PlayerDatas.Instance.baseData.MapID == 32080 // || PlayerDatas.Instance.baseData.MapID == CrossServerBossModel.DATA_MAPID; Main/System/Debug/DebugUtility.cs
@@ -112,18 +112,18 @@ // TODO YYL // if (StageLoad.Instance.currentStage is LoginStage) // { // var loginWin = WindowCenter.Instance.Get<LoginWin>(); // if (loginWin != null) // { // var accountIpf = loginWin.transform.FindComponent("InputField", "Container_Account/AccountInput"); // if (accountIpf != null) // { // (accountIpf as InputField).text = StringUtility.Contact("Test_", UnityEngine.Random.Range(10000, 99999)); // } var loginWin = UIManager.Instance.GetUI<LoginWin>(); if (loginWin != null) { var accountIpf = loginWin.transform.FindComponent("InputField", "Container_Account/AccountInput"); if (accountIpf != null) { (accountIpf as InputField).text = StringUtility.Contact("Test_", UnityEngine.Random.Range(10000, 99999)); } // var enterGame = loginWin.transform.FindComponent("Button", "Container_EnterGame/LoginButton"); // (enterGame as Button).onClick.Invoke(); // } var enterGame = loginWin.transform.FindComponent("Button", "Container_EnterGame/LoginButton"); (enterGame as Button).onClick.Invoke(); } // } Main/System/Equip/EquipSuitEffect.cs
@@ -1,8 +1,6 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; namespace vnxbqy.UI { public class EquipSuitEffect : MonoBehaviour { [SerializeField] UIEffect m_SuitEffect; @@ -103,6 +101,4 @@ return 1f; } } } } } Main/System/ItemTip/ItemTipUtility.cs
@@ -8,9 +8,6 @@ using System.Collections.Generic; using System.Linq; namespace vnxbqy.UI { public class ItemTipUtility { public enum TipType @@ -2028,8 +2025,5 @@ } } } Main/System/KnapSack/KnapsackTimeCDMgr.cs
@@ -4,8 +4,6 @@ using UnityEngine.UI; namespace vnxbqy.UI { public class KnapsackTimeCDMgr : SingletonMonobehaviour<KnapsackTimeCDMgr> @@ -278,5 +276,3 @@ return remainTime; } } } Main/System/KnapSack/Logic/CommonGetItem.cs
@@ -1,7 +1,5 @@ using UnityEngine; namespace vnxbqy.UI { public class CommonGetItem : MonoBehaviour { [SerializeField] ItemCell itemCell; @@ -24,4 +22,3 @@ }); } } } Main/System/KnapSack/Logic/CommonGetItemCell.cs
@@ -3,8 +3,6 @@ using UnityEngine; using UnityEngine.UI; namespace vnxbqy.UI { public class CommonGetItemCell : CellView { [SerializeField] List<CommonGetItem> commonGetItems = new List<CommonGetItem>(); @@ -32,4 +30,3 @@ } } } } Main/System/KnapSack/Logic/CommonGetItemWin.cs
@@ -2,8 +2,6 @@ using UnityEngine; using UnityEngine.UI; namespace vnxbqy.UI { //用于显示获得物品的窗口 public class CommonGetItemWin : UIBase { @@ -123,4 +121,3 @@ _cell?.Display(cell.index); } } } Main/System/KnapSack/Logic/ItemLogicUtility.cs
@@ -4,8 +4,6 @@ using LitJson; using UnityEngine; namespace vnxbqy.UI { public class ItemLogicUtility : Singleton<ItemLogicUtility> { @@ -1824,5 +1822,3 @@ getItemEventName = ""; } } } Main/System/KnapSack/Logic/ItemModel.cs
@@ -3,8 +3,6 @@ using System.Collections.Generic; namespace vnxbqy.UI { public class ItemModel { public readonly PackType packType; @@ -183,7 +181,5 @@ } } } Main/System/KnapSack/Logic/SinglePack.cs
@@ -4,8 +4,6 @@ using System.Text; using vnxbqy.UI; namespace vnxbqy.UI { public class SinglePack { public readonly PackType type; @@ -384,5 +382,4 @@ public List<int> jobs; } } } } Main/System/KnapSack/New/CommonItemBaisc.cs
@@ -3,8 +3,6 @@ using UnityEngine; using UnityEngine.UI; namespace vnxbqy.UI { public enum ItemCellformat { Format_84x84, @@ -369,7 +367,4 @@ } } } Main/System/KnapSack/New/ItemCell.cs
@@ -4,9 +4,6 @@ using System.Collections.Generic; using System; namespace vnxbqy.UI { public class ItemCell : CommonItemBaisc { private Button m_Reducebtn; @@ -72,5 +69,4 @@ timeMark?.SetActive(model.itemConfig.Type == 145 && model.itemConfig.CDTime > 0); } } } Main/System/Language/Language.cs
@@ -88,26 +88,26 @@ public static string Get(string _id) { // TODO YYL return string.Empty; // var languageInfo = LanguageConfig.Get(_id); // if (languageInfo == null) // { // #if UNITY_EDITOR // if (_id.StartsWith(NewBieGuideScriptableObject.GuidesPrefixNewBie) || // _id.StartsWith(NewBieGuideScriptableObject.GuidesPrefixFun)) // return string.Empty; // Debug.LogFormat("缺少语言表配置,id: {0}", _id); // #endif // return string.Empty; // } // return string.Empty; var languageInfo = LanguageConfig.Get(_id); if (languageInfo == null) { #if UNITY_EDITOR // TODO YYL // if (_id.StartsWith(NewBieGuideScriptableObject.GuidesPrefixNewBie) || // _id.StartsWith(NewBieGuideScriptableObject.GuidesPrefixFun)) // return string.Empty; // Debug.LogFormat("缺少语言表配置,id: {0}", _id); #endif return string.Empty; } // if (string.IsNullOrEmpty(languageInfo.content)) // { // Debug.LogFormat("语言内容为空,id: {0}", _id); // } if (string.IsNullOrEmpty(languageInfo.content)) { Debug.LogFormat("语言内容为空,id: {0}", _id); } // return languageInfo.content; return languageInfo.content; } public static string Get(string _id, params object[] _objects) @@ -127,20 +127,19 @@ public static string GetFromLocal(int _id) { return string.Empty; // TODO YYL // var languageInfo = PriorLanguageConfig.Get(_id); // if (languageInfo == null) // { // Debug.LogFormat("缺少语言表配置,id: {0}", _id); // return string.Empty; // } var languageInfo = PriorLanguageConfig.Get(_id); if (languageInfo == null) { Debug.LogFormat("缺少语言表配置,id: {0}", _id); return string.Empty; } // if (string.IsNullOrEmpty(languageInfo.Content)) // { // Debug.LogFormat("语言内容为空,id: {0}", _id); // } if (string.IsNullOrEmpty(languageInfo.Content)) { Debug.LogFormat("语言内容为空,id: {0}", _id); } // return languageInfo.Content; return languageInfo.Content; } public static string GetFromLocal(int _id, params object[] _objects) Main/System/Login/LoginWin.cs
@@ -131,15 +131,14 @@ // var sprite = BuiltInLoader.LoadSprite("TB_DL_Logo"); // TODO YYL // bool hasNotice = GameNotice.HasNotice(); bool hasNotice = GameNotice.HasNotice(); // 账号切换 m_SwitchAccount.SetActive(false); // 用户帮助 // TODO YYL // var appId = VersionConfig.Get().appId; // var branch = VersionConfig.Get().branch; var appId = VersionConfig.Get().appId; var branch = VersionConfig.Get().branch; // m_UserHelp.SetActive(ContactConfig.GetConfig(appId, branch) != null); // 是否已经获取到服务器列表 @@ -149,7 +148,7 @@ m_ContainerEnterGame.SetActive(isGetServerList); m_ContainerAccount.SetActive(isGetServerList && (VersionConfig.Get().versionAuthority == VersionAuthority.InterTest || VersionConfig.Get().isBanShu)); // loginBtn.SetActive(isGetServerList); m_EnterGame.SetActive(isGetServerList); if (isGetServerList) { @@ -231,7 +230,6 @@ { if (!checkRead.isOn) { // TODO YYL ConfirmCancel.ShowPopConfirm(Language.Get("agreementTitle"), Language.Get("agreementInfo")); LocalSave.SetBool("tqsecretToggle", false); //方便测试 return; @@ -266,7 +264,6 @@ private void OpenServerListWin() { // TODO YYL UIManager.Instance.OpenWindow<ServerListWin>(); } @@ -283,10 +280,9 @@ private void OpenUserHelp() { // TODO YYL // TODO YYL // UIManager.Instance.OpenWindow<UserHelpWin>(); } protected void Login() { @@ -312,12 +308,11 @@ { switch ((ServerState)ServerListCenter.Instance.currentServer.running_status) { // TODO YYL case ServerState.Maintain: // SysNotifyMgr.Instance.ShowTip("ServerDown"); SysNotifyMgr.Instance.ShowTip("ServerDown"); break; case ServerState.Predicted: // SysNotifyMgr.Instance.ShowTip("ServerOpen", ServerListCenter.Instance.currentServer.start_date.ToString("yyyy-MM-dd HH:mm")); SysNotifyMgr.Instance.ShowTip("ServerOpen", ServerListCenter.Instance.currentServer.start_date.ToString("yyyy-MM-dd HH:mm")); break; } @@ -331,8 +326,7 @@ case VersionAuthority.InterTest: if (string.IsNullOrEmpty(m_Account.text)) { // TODO YYL // ServerTipDetails.DisplayNormalTip(Language.Get("L1095")); ServerTipDetails.DisplayNormalTip(Language.Get("L1095")); return; } Main/System/MainInterfacePanel/MainRedDot.cs
@@ -8,9 +8,6 @@ using System.Collections.Generic; using System; namespace vnxbqy.UI { public class MainRedDot : Singleton<MainRedDot> { @@ -224,8 +221,6 @@ } } } Main/System/MainInterfacePanel/TaskAllocation.cs
New file @@ -0,0 +1,162 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Monday, November 06, 2017 //-------------------------------------------------------- using UnityEngine; using System.Collections; using UnityEngine.UI; using System.Text; using System.Text.RegularExpressions; using System.Collections.Generic; using System; //用于任务分配 namespace vnxbqy.UI { public class TaskAllocation : Singleton<TaskAllocation> { private static StringBuilder textBuilder = new StringBuilder(); private const string Info_Pattern = "{([a-zA-Z0-9_]+)}"; public string GetTaskInfo(string val, int _item)//用于0820中字典的值替换(1字符串2任务ID) { textBuilder.Length = 0; int index = 0; if (Regex.IsMatch(val, Info_Pattern)) { if (TaskManager.Instance.ReplaceDic.ContainsKey(_item)) { Dictionary<string, int> _dic = TaskManager.Instance.ReplaceDic[_item]; foreach (Match match in Regex.Matches(val, Info_Pattern)) { textBuilder.Append(val.Substring(index, match.Index - index)); if (_dic.ContainsKey(match.Groups[1].Value)) { textBuilder.Append(_dic[match.Groups[1].Value]); } else { textBuilder.Append(0); } index = match.Index + match.Length; } } textBuilder.Append(val.Substring(index, val.Length - index)); return textBuilder.ToString(); } else { return val; } } public int ForRingNumber()//获取赏金环数 { if (TaskManager.Instance.ReplaceDic.ContainsKey(1)) { Dictionary<string, int> _dic = TaskManager.Instance.ReplaceDic[1]; if (_dic.ContainsKey("around_count")) { string str = "around_count"; return _dic[str]; } } return 0; } public int ForRingAllNumber()//获取赏金总环数 { if (TaskManager.Instance.ReplaceDic.ContainsKey(1)) { Dictionary<string, int> _dic = TaskManager.Instance.ReplaceDic[1]; if (_dic.ContainsKey("around_allcount")) { string str = "around_allcount"; return _dic[str]; } } return 0; } public int FairyAuNumber()//获取仙盟环数 { if (TaskManager.Instance.ReplaceDic.ContainsKey(1)) { Dictionary<string, int> _dic = TaskManager.Instance.ReplaceDic[1]; if (_dic.ContainsKey("around_count_family")) { string str = "around_count_family"; return _dic[str]; } } return 0; } public int FairyAuAllNumber()//获取仙盟总环数 { if (TaskManager.Instance.ReplaceDic.ContainsKey(1)) { Dictionary<string, int> _dic = TaskManager.Instance.ReplaceDic[1]; if (_dic.ContainsKey("around_allcount_family")) { string str = "around_allcount_family"; return _dic[str]; } } return 0; } // PlayerMainDate m_MainModel; // PlayerMainDate mainModel { get { return m_MainModel ?? (m_MainModel = ModelCenter.Instance.GetModel<PlayerMainDate>()); } } public void SkillTask(int TaskID)//用于解锁被动技能任务 { // int Gold = (int)UIHelper.GetMoneyCnt(1);//仙玉 // if (mainModel.TaskId_Skill.Contains(TaskID)) // { // int Index = mainModel.TaskId_Skill.IndexOf(TaskID); // int NeedMoney = mainModel.NeedFairyJade[Index]; // string strNull = string.Format(Language.Get("PassiveSkillTask3"), NeedMoney); // ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), strNull, (bool isOk) => // { // if (isOk) // { // if (Gold >= NeedMoney) // { // TaskManager.Instance.CompletionOfTask(TaskID); // if (WindowCenter.Instance.IsOpen<SkillWin>()) // { // return; // } // WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.SkillFunc2Type2); // } // else // { // if (VersionConfig.Get().isBanShu) // { // SysNotifyMgr.Instance.ShowTip("GoldErr"); // return; // } // WindowCenter.Instance.Open<RechargeTipWin>(); // } // } // }); // } } DateTime m_TaskTime = DateTime.Now; public DateTime TaskTime { get { return m_TaskTime; } set { m_TaskTime = value; } } } } Main/System/MainInterfacePanel/TaskAllocation.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: a473681297500234c97b387af8d2242b MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/System/Message/MessageWin.cs
@@ -297,11 +297,10 @@ void DisplayChatHint(SystemHintData hint) { // TODO YYL // if (!UIManager.Instance.IsOpened<ChatWin>()) // { // return; // } if (!UIManager.Instance.IsOpened<ChatWin>()) { return; } if (!m_ContainerChatHint.gameObject.activeInHierarchy) { m_ContainerChatHint.gameObject.SetActive(true); Main/System/Message/RichText.cs
@@ -181,7 +181,7 @@ unline = transform.GetComponentInChildren<TextUnline>(); if (unline == null) { GameObject obj = Resources.Load("TextUnline") as GameObject; GameObject obj = Resources.Load("UIComp/TextUnline") as GameObject; // GameObject obj = UILoader.LoadPrefab("TextUnline") as GameObject; obj = Instantiate(obj); obj.transform.SetParent(transform); @@ -200,7 +200,6 @@ return; } #endif // TODO YYL 配置加载完成与否的判定可能还需要考量 if (language && !string.IsNullOrEmpty(enableDisplay) && Application.isPlaying/* && ConfigInitiator.done*/) { text = Language.Get(enableDisplay); Main/System/Message/SysNotifyMgr.cs
@@ -15,8 +15,7 @@ /// <summary> /// 服务端下发的数据 /// </summary> // TODO YYL // private H0212_tagNotifyCode.tagNotifyStr[] sysNotifyMsg; private H0212_tagNotifyCode.tagNotifyStr[] sysNotifyMsg; private ArrayList tipInfoList = new ArrayList(); @@ -32,8 +31,7 @@ private void Awake() { // TODO YYL // DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += BeforePlayerDataInitializeEvent; DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += BeforePlayerDataInitializeEvent; // StageLoad.Instance.onStageLoadFinish += OnStageLoadFinish; Co_Instance().Forget(); } @@ -58,8 +56,7 @@ protected override void OnDestroy() { base.OnDestroy(); // TODO YYL // DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent -= BeforePlayerDataInitializeEvent; DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent -= BeforePlayerDataInitializeEvent; // StageLoad.Instance.onStageLoadFinish -= OnStageLoadFinish; } @@ -77,35 +74,35 @@ } // // TODO YYL // public void ReceiveNotifyCode(H0212_tagNotifyCode vNetData) // { // if (vNetData != null) // { // sysNotifyMsg = vNetData.Pars; public void ReceiveNotifyCode(H0212_tagNotifyCode vNetData) { if (vNetData != null) { sysNotifyMsg = vNetData.Pars; // tipInfoList.Clear(); // for (int i = 0; i < sysNotifyMsg.Length; i++) // { // if (sysNotifyMsg[i].Len != 0) // { // var _msg = sysNotifyMsg[i].Msg; // _msg = _msg.Replace(" ", string.Empty); // tipInfoList.Add(_msg); // } // else // { // tipInfoList.Add(sysNotifyMsg[i].MsgInt); // } // } tipInfoList.Clear(); for (int i = 0; i < sysNotifyMsg.Length; i++) { if (sysNotifyMsg[i].Len != 0) { var _msg = sysNotifyMsg[i].Msg; _msg = _msg.Replace(" ", string.Empty); tipInfoList.Add(_msg); } else { tipInfoList.Add(sysNotifyMsg[i].MsgInt); } } // if (sysNotifyEvent != null) // { // sysNotifyEvent(vNetData.Msg, tipInfoList); // } if (sysNotifyEvent != null) { sysNotifyEvent(vNetData.Msg, tipInfoList); } // GetSysMsg(vNetData.Msg); // } // } GetSysMsg(vNetData.Msg); } } void GetSysMsg(string key) { @@ -115,9 +112,8 @@ { #if UNITY_EDITOR string hint = Language.Get("L1093", key); // TODO YYL ScrollTip.ShowTip(hint); // ChatCtrl.Inst.RevChatInfo(hint); ChatManager.Instance.RevChatInfo(hint); #endif } else @@ -225,19 +221,18 @@ ServerTipDetails.ShowMarquee(msg, tipInfoList,order); break; // TODO YYL // case SysNotifyType.SysChanelTip: // ChatCtrl.Inst.RevChatInfo(msg, tipInfoList); // break; // case SysNotifyType.SysFairyQuestionTip: // ChatCtrl.Inst.RevChatInfo(msg, tipInfoList, ChatInfoType.FairyQuestion); // break; // case SysNotifyType.SysFairyTip: // ChatCtrl.Inst.RevChatInfo(msg, tipInfoList, ChatInfoType.FairyTip); // break; // case SysNotifyType.SysTeamTip: // ChatCtrl.Inst.RevChatInfo(msg, tipInfoList, ChatInfoType.TeamTip); // break; case SysNotifyType.SysChanelTip: ChatManager.Instance.RevChatInfo(msg, tipInfoList); break; case SysNotifyType.SysFairyQuestionTip: ChatManager.Instance.RevChatInfo(msg, tipInfoList, ChatInfoType.FairyQuestion); break; case SysNotifyType.SysFairyTip: ChatManager.Instance.RevChatInfo(msg, tipInfoList, ChatInfoType.FairyTip); break; case SysNotifyType.SysTeamTip: ChatManager.Instance.RevChatInfo(msg, tipInfoList, ChatInfoType.TeamTip); break; case SysNotifyType.SysRealmTip: if (OnSysTipEvent != null) { @@ -249,9 +244,9 @@ // case SysNotifyType.SysEvenKill: // BattleHint.Instance.ReceiveEvenKill(msg, tipInfoList); // break; // case SysNotifyType.SysFactionTip: // ChatCtrl.Inst.RevChatInfo(msg, tipInfoList, ChatInfoType.default2); // break; case SysNotifyType.SysFactionTip: ChatManager.Instance.RevChatInfo(msg, tipInfoList, ChatInfoType.default2); break; } } Main/System/SystemSetting/SystemSetting.cs
@@ -27,14 +27,12 @@ public SystemSetting() { // TODO YYL // DTC0102_tagCDBPlayer.switchAccountEvent += OnSwitchAccount; DTC0102_tagCDBPlayer.switchAccountEvent += OnSwitchAccount; } ~SystemSetting() { // TODO YYL // DTC0102_tagCDBPlayer.switchAccountEvent -= OnSwitchAccount; DTC0102_tagCDBPlayer.switchAccountEvent -= OnSwitchAccount; } public void SetSoundVolume(float _volume) Main/Utility/SafeAreaUI.cs
New file @@ -0,0 +1,139 @@ using UnityEngine; [ExecuteAlways] [RequireComponent(typeof(RectTransform))] public class SafeAreaUI : MonoBehaviour { public const int SafeWidth = 75; public enum SimDevice { None, IphoneX } public static SimDevice Sim { set { LocalSave.SetInt("SimDevice", (int)value); } get { return (SimDevice)LocalSave.GetInt("SimDevice"); } } Rect[] NSA_IphoneX = new Rect[] { new Rect (0f, 102f / 2436f, 1f, 2202f / 2436f), // Portrait new Rect (132f / 2436f, 63f / 1125f, 2172f / 2436f, 1062f / 1125f) // Landscape }; RectTransform _Panel; Rect LastSafeArea = new Rect(0, 0, 0, 0); Rect LastRect = new Rect(0, 0, 0, 0); RectTransform Panel { get { if (_Panel == null) _Panel = GetComponent<RectTransform>(); return _Panel; } } void Awake() { Refresh(); } void Update() { Refresh(); } void Refresh() { // Rect safeArea = GetSafeArea(); // if (safeArea != LastSafeArea || LastRect != Panel.rect) if (LastRect != Panel.rect) ApplySafeArea(); } public void ApplySafeArea() { Panel.anchorMin = Vector2.zero; Panel.anchorMax = Vector2.one; //竖屏 if (Screen.height > Screen.width) { if (Screen.height / Screen.width > 1.8)//宽屏需要适配 { //上下各间隔SafeWidth Panel.offsetMin = new Vector2(0, SafeWidth); Panel.offsetMax = new Vector2(0, -SafeWidth); } else { Panel.offsetMin = new Vector2(0, 0); Panel.offsetMax = new Vector2(0, 0); } } else {//横屏 if (Screen.width / Screen.height > 1.8)//宽屏需要适配 { //两边各间隔SafeWidth Panel.offsetMin = new Vector2(SafeWidth, 0); Panel.offsetMax = new Vector2(-SafeWidth, 0); } else { Panel.offsetMin = new Vector2(0, 0); Panel.offsetMax = new Vector2(0, 0); } } LastRect = Panel.rect; } #region 系统api的安全区 Rect GetSafeArea() { if (!Application.isEditor) return Screen.safeArea; Rect safeArea = Screen.safeArea; if (Sim != SimDevice.None) { Rect nsa = new Rect(0, 0, Screen.width, Screen.height); switch (Sim) { case SimDevice.IphoneX: if (Screen.height > Screen.width) // Portrait nsa = NSA_IphoneX[0]; else // Landscape nsa = NSA_IphoneX[1]; break; default: break; } safeArea = new Rect(Screen.width * nsa.x, Screen.height * nsa.y, Screen.width * nsa.width, Screen.height * nsa.height); } return safeArea; } void ApplySafeArea(Rect safeArea) { Debug.LogFormat("ApplySafeArea:{0} ; rect:{1}", safeArea, Panel.rect); Panel.anchorMin = Vector2.zero; Panel.anchorMax = Vector2.one; //适配四个方向 // Panel.offsetMin = safeArea.min; // Panel.offsetMax = new Vector2(-(Screen.width - safeArea.max.x), -(Screen.height - safeArea.max.y)); //只适配两边 Panel.offsetMin = new Vector2(safeArea.min.x, 0); Panel.offsetMax = new Vector2(-(Screen.width - safeArea.max.x), 0); LastRect = Panel.rect; LastSafeArea = safeArea; } #endregion } Main/Utility/SafeAreaUI.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 97bb4ff2bfab6ac40abce2181e67aa6a MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: