From 16a90aa94d8579cc120c9962d389b59bda5e7398 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期四, 28 八月 2025 22:23:34 +0800
Subject: [PATCH] 95 【主界面】自动挂机
---
Main/System/Equip/EquipModel.cs | 27
Main/Core/NetworkPackage/DTCFile/ServerPack/H01_System/DTC0102_tagCDBPlayer.cs | 2
Main/System/Login/LoginWin.cs | 7
Main/System/CustomizedGift/CustomizedGiftModel.cs | 4
Main/Core/NetworkPackage/ClientPack/C03_MainCharacter/C0303_tagCSetShutCutData.cs.meta | 5
Main/System/Main/AutoFightWin.cs | 244 ++++++++++
Main/Component/UI/Common/FuncOpen.cs | 490 ++++++++++----------
Main/Component/UI/Common/UIFuncOpen.cs | 123 ++--
Main/Core/NetworkPackage/ClientPack/C03_MainCharacter/C0303_tagCSetShutCutData.cs | 17
Main/System/Setting/QuickSetting.cs.meta | 5
Main/System/Main/HomeWin.cs | 56 +
Main/Main.cs | 1
Main/System/Setting.meta | 8
Main/System/Message/SysNotifyMgr.cs | 16
Main/Config/Configs/FuncOpenLVConfig.cs | 14
Main/Config/Configs/HeroQualityConfig.cs | 51 -
Main/System/Main/AutoFightModel.cs | 116 ++++
Main/System/Task/TaskManager.cs | 8
Main/System/Setting/QuickSetting.cs | 166 ++++++
Main/System/Main/AutoFightWin.cs.meta | 5
/dev/null | 40 -
Main/System/Recharge/RechargeManager.cs | 18
Main/Utility/UIHelper.cs | 4
Main/System/CustomizedGift/CustomizedRechargeModel.cs | 6
Main/System/Main/MainWin.cs | 4
25 files changed, 992 insertions(+), 445 deletions(-)
diff --git a/Main/Component/UI/Common/FuncEnable.cs b/Main/Component/UI/Common/FuncEnable.cs
deleted file mode 100644
index f5e3877..0000000
--- a/Main/Component/UI/Common/FuncEnable.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-锘縰sing System;
-using System.Collections;
-using System.Collections.Generic;
-
-using UnityEngine;
- public class FuncEnable : MonoBehaviour
- {
- [SerializeField] int funcOpenKey;
-
- private void Awake()
- {
- FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChangeEvent;
- }
-
- private void OnEnable()
- {
- SetState();
- }
-
- private void OnFuncStateChangeEvent(int _key)
- {
- if (funcOpenKey == _key)
- {
- SetState();
- }
- }
-
- void SetState()
- {
- var _funcOpenCfg = FuncOpenLVConfig.Get(funcOpenKey);
- if (_funcOpenCfg != null && _funcOpenCfg.open == 0)
- {
- gameObject.SetActive(false);
- return;
- }
-
- gameObject.SetActive(true);
- }
- }
-
diff --git a/Main/Component/UI/Common/FuncOpen.cs b/Main/Component/UI/Common/FuncOpen.cs
index f5276a3..84ddee8 100644
--- a/Main/Component/UI/Common/FuncOpen.cs
+++ b/Main/Component/UI/Common/FuncOpen.cs
@@ -4,250 +4,258 @@
using UnityEngine;
using LitJson;
- public class FuncOpen
- {
- private static FuncOpen _inst = null;
- public static FuncOpen Instance {
- get {
- if (_inst == null)
- {
- _inst = new FuncOpen();
- }
- return _inst;
- }
- }
-
- protected FuncOpen()
- {
- if (Application.isEditor)
+public class FuncOpen
+{
+ private static FuncOpen _inst = null;
+ public static FuncOpen Instance {
+ get {
+ if (_inst == null)
{
- if (!Application.isPlaying) return;
+ _inst = new FuncOpen();
}
-
- 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;
-
- 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;
- }
- }
-
- private void SwitchAccountEvent()
- {
- for (int i = 0; i < funcArray.Length; i++)
- {
- funcOpenState[funcArray[i]] = false;
- if (OnFuncStateChangeEvent != null)
- {
- OnFuncStateChangeEvent(funcArray[i]);
- }
- }
- }
-
- // TaskModel m_TaskModel;
- // TaskModel taskmodel { get { return m_TaskModel ?? (m_TaskModel = ModelCenter.Instance.GetModel<TaskModel>()); } }
- private static Dictionary<int, bool> funcOpenState = new Dictionary<int, bool>();
- private int[] funcArray;
-
- public event Action<int> OnFuncStateChangeEvent;
-
- //绾鎴风鐨勫姛鑳界瓑绾ч檺鍒�, key 浠ュ姛鑳介厤缃〃鐨凢uncLevelLimitClient涓哄噯
- //1. 绮惧僵娲诲姩-鍏ㄦ湇绾㈠寘鏄剧ず绛夌骇
- public Dictionary<int, int> funcClientLVLimitDict = new Dictionary<int, int>();
- public bool IsClientLVLimit(int key)
- {
- if (!funcClientLVLimitDict.ContainsKey(key))
- return true;
-
- if (PlayerDatas.Instance.baseData.LV >= funcClientLVLimitDict[key])
- return true;
-
- return false;
- }
-
-
- public void UpdateFuncState(HA302_tagMCFuncOpenStateList vNetData)
- {
- for (int i = 0; i < vNetData.FuncCount; i++)
- {
-
- var funcState = vNetData.FuncStateList[i];
-
- 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);
- }
- }
- }
-
- private bool IsFuncOpen(int key, out int errorCode)
- {
-
- errorCode = 0;
- var config = FuncOpenLVConfig.Get(key);
- if (config == null)
- {
- return false;
- }
- // if (config.LimitMagicWeapon > 0)
- // {
- // Treasure treasure = null;
- // var _stage = config.LimitMagicWeapon % 100;
- // ModelCenter.Instance.GetModel<TreasureModel>().TryGetTreasure(config.LimitMagicWeapon / 100, out treasure);
- // if (treasure == null || treasure.state != TreasureState.Collected || treasure.level < _stage)
- // {
- // errorCode = 2;
- // return false;
- // }
- // }
- // if (config.LimitMissionID > 0)
- // {
- // MissionDetailDates missionDetailDates = null;
- // taskmodel.allMissionDict.TryGetValue(config.LimitMissionID, out missionDetailDates);
- // if (missionDetailDates == null || missionDetailDates.MissionState != 3)
- // {
- // errorCode = 4;
- // return false;
- // }
- // }
- // if (config.LimiRealmLV > 0 && PlayerDatas.Instance.baseData.realmLevel < config.LimiRealmLV)
- // {
- // errorCode = 3;
- // 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);
- 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;
- // 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)
- {
- // FuncOpenLVConfig tagFuncOpenLVModel = FuncOpenLVConfig.Get(key);
- // if (tagFuncOpenLVModel.LimitLV != 0)
- // {
- // return tagFuncOpenLVModel.LimitLV;
- // }
- // if (tagFuncOpenLVModel.LimitMissionID != 0)
- // {
- // var TaskConfig = PyTaskConfig.Get(tagFuncOpenLVModel.LimitMissionID);
- // return TaskConfig.lv;
- // }
-
- return 1;
- }
-
- Dictionary<int, ICheckFuncOpen> m_CheckFuncDict = new Dictionary<int, ICheckFuncOpen>();
- public void Register(int _key, ICheckFuncOpen _check)
- {
- if (!m_CheckFuncDict.ContainsKey(_key))
- {
- m_CheckFuncDict.Add(_key, _check);
- }
- }
-
- public bool CheckFuncOpen(int _key)
- {
- if (m_CheckFuncDict.ContainsKey(_key))
- {
- return m_CheckFuncDict[_key].CheckFunc();
- }
- return true;
+ return _inst;
}
}
- public interface ICheckFuncOpen
+ protected FuncOpen()
{
- bool CheckFunc();
- }
\ No newline at end of file
+ if (Application.isEditor)
+ {
+ if (!Application.isPlaying) return;
+ }
+
+ 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;
+
+ 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;
+ }
+ }
+
+ private void SwitchAccountEvent()
+ {
+ for (int i = 0; i < funcArray.Length; i++)
+ {
+ funcOpenState[funcArray[i]] = false;
+ if (OnFuncStateChangeEvent != null)
+ {
+ OnFuncStateChangeEvent(funcArray[i]);
+ }
+ }
+ }
+
+ // TaskModel m_TaskModel;
+ // TaskModel taskmodel { get { return m_TaskModel ?? (m_TaskModel = ModelCenter.Instance.GetModel<TaskModel>()); } }
+ private static Dictionary<int, bool> funcOpenState = new Dictionary<int, bool>();
+ private int[] funcArray;
+
+ public event Action<int> OnFuncStateChangeEvent;
+
+ //绾鎴风鐨勫姛鑳界瓑绾ч檺鍒�, key 浠ュ姛鑳介厤缃〃鐨凢uncLevelLimitClient涓哄噯
+ //1. 绮惧僵娲诲姩-鍏ㄦ湇绾㈠寘鏄剧ず绛夌骇
+ public Dictionary<int, int> funcClientLVLimitDict = new Dictionary<int, int>();
+ public bool IsClientLVLimit(int key)
+ {
+ if (!funcClientLVLimitDict.ContainsKey(key))
+ return true;
+
+ if (PlayerDatas.Instance.baseData.LV >= funcClientLVLimitDict[key])
+ return true;
+
+ return false;
+ }
+
+
+ public void UpdateFuncState(HA302_tagMCFuncOpenStateList vNetData)
+ {
+ for (int i = 0; i < vNetData.FuncCount; i++)
+ {
+
+ var funcState = vNetData.FuncStateList[i];
+
+ 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);
+ }
+ }
+ }
+
+ private bool IsFuncOpen(int key, out int errorCode)
+ {
+
+ errorCode = 0;
+ var config = FuncOpenLVConfig.Get(key);
+ if (config == null)
+ {
+ return false;
+ }
+
+ if (config.OpenDay > 0)
+ {
+ if (config.OpenDay > TimeUtility.OpenDay + 1)
+ {
+ errorCode = 2;
+ return false;
+ }
+ }
+
+ if (config.LimitMissionID > 0)
+ {
+
+ if (TaskManager.Instance.GetNeedFinishTaskCount(config.LimitMissionID) > 0)
+ {
+ errorCode = 4;
+ return false;
+ }
+ }
+ if (config.LimiRealmLV > 0 && PlayerDatas.Instance.baseData.realmLevel < config.LimiRealmLV)
+ {
+ errorCode = 3;
+ 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);
+ return isOpen;
+ }
+
+ public void ProcessorFuncErrorTip(int key)
+ {
+ var config = FuncOpenLVConfig.Get(key);
+ if (config != null)
+ {
+ SoundPlayer.Instance.PlayUIAudio(SoundPlayer.defaultClickNegativeAudio);
+
+ var errorCode = 0;
+ if (!IsFuncOpen(key, out errorCode))
+ {
+ switch (errorCode)
+ {
+ case 1:
+ SysNotifyMgr.Instance.ShowStringTip(Language.Get("FuncLimit_Level", config.LimitLV)
+ + Language.Get("FuncLimitOpen1"));
+ break;
+ case 2:
+ //寮�鏈嶅灏戝ぉ 涓�鑸槸缁勫悎
+ if (config.LimitLV != 0)
+ {
+ SysNotifyMgr.Instance.ShowStringTip(Language.Get("FuncLimit_OpenDay", config.OpenDay)
+ + Language.Get("FuncLimitOpen2")
+ + Language.Get("FuncLimit_Level", config.LimitLV)
+ + Language.Get("FuncLimitOpen1"));
+
+ }
+ else if (config.LimitMissionID != 0)
+ {
+ SysNotifyMgr.Instance.ShowStringTip(Language.Get("FuncLimit_OpenDay", config.OpenDay)
+ + Language.Get("FuncLimitOpen2")
+ + Language.Get("FuncLimit_Mission", TaskManager.Instance.GetNeedFinishTaskCount(config.LimitMissionID))
+ + Language.Get("FuncLimitOpen1"));
+ }
+ else
+ {
+ SysNotifyMgr.Instance.ShowStringTip(Language.Get("FuncLimit_OpenDay", config.OpenDay)
+ + Language.Get("FuncLimitOpen1"));
+ }
+ break;
+ case 3:
+ SysNotifyMgr.Instance.ShowStringTip(Language.Get("FuncLimit_Realm", RealmConfig.Get(config.LimiRealmLV).Name)
+ + Language.Get("FuncLimitOpen1"));
+ break;
+ case 4:
+ SysNotifyMgr.Instance.ShowStringTip(Language.Get("FuncLimit_Mission", TaskManager.Instance.GetNeedFinishTaskCount(config.LimitMissionID))
+ + Language.Get("FuncLimitOpen1"));
+ break;
+ }
+ }
+ }
+ }
+
+ public int GetLimitLv(int key)
+ {
+ // FuncOpenLVConfig tagFuncOpenLVModel = FuncOpenLVConfig.Get(key);
+ // if (tagFuncOpenLVModel.LimitLV != 0)
+ // {
+ // return tagFuncOpenLVModel.LimitLV;
+ // }
+ // if (tagFuncOpenLVModel.LimitMissionID != 0)
+ // {
+ // var TaskConfig = PyTaskConfig.Get(tagFuncOpenLVModel.LimitMissionID);
+ // return TaskConfig.lv;
+ // }
+
+ return 1;
+ }
+
+ Dictionary<int, ICheckFuncOpen> m_CheckFuncDict = new Dictionary<int, ICheckFuncOpen>();
+ public void Register(int _key, ICheckFuncOpen _check)
+ {
+ if (!m_CheckFuncDict.ContainsKey(_key))
+ {
+ m_CheckFuncDict.Add(_key, _check);
+ }
+ }
+
+ public bool CheckFuncOpen(int _key)
+ {
+ if (m_CheckFuncDict.ContainsKey(_key))
+ {
+ return m_CheckFuncDict[_key].CheckFunc();
+ }
+ return true;
+ }
+}
+
+public interface ICheckFuncOpen
+{
+ bool CheckFunc();
+}
\ No newline at end of file
diff --git a/Main/Component/UI/Common/UIFuncOpen.cs b/Main/Component/UI/Common/UIFuncOpen.cs
index c4c0ce6..08e825e 100644
--- a/Main/Component/UI/Common/UIFuncOpen.cs
+++ b/Main/Component/UI/Common/UIFuncOpen.cs
@@ -8,86 +8,87 @@
using System;
using UnityEngine.EventSystems;
- public class UIFuncOpen : MonoBehaviour, IPointerClickHandler
+public class UIFuncOpen : MonoBehaviour, IPointerClickHandler
+{
+ [SerializeField] int funcOpenKey;
+ [SerializeField] GameObject LockImg;
+ [SerializeField] bool active = true;
+ public int id { get { return funcOpenKey; } }
+
+ private Button funcBtn;
+
+ private void Awake()
{
- [SerializeField] int funcOpenKey;
- [SerializeField] GameObject LockImg;
- [SerializeField] bool active = true;
- public int id { get { return funcOpenKey; } }
+ funcBtn = GetComponent<Button>();
- private Button funcBtn;
+ FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChangeEvent;
+ }
- private void Awake()
+ public void OnPointerClick(PointerEventData eventData)
+ {
+ if (!FuncOpen.Instance.IsFuncOpen(funcOpenKey))
{
- funcBtn = GetComponent<Button>();
-
- FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChangeEvent;
+ FuncOpen.Instance.ProcessorFuncErrorTip(funcOpenKey);
+ return;
}
+ }
- public void OnPointerClick(PointerEventData eventData)
- {
- if (!FuncOpen.Instance.IsFuncOpen(funcOpenKey))
- {
- FuncOpen.Instance.ProcessorFuncErrorTip(funcOpenKey);
- return;
- }
- }
+ private void OnEnable()
+ {
+ SetState();
+ }
- private void OnEnable()
+ private void OnFuncStateChangeEvent(int func)
+ {
+ if (funcOpenKey == func)
{
SetState();
}
+ }
- private void OnFuncStateChangeEvent(int func)
+ private void OnDestroy()
+ {
+ FuncOpen.Instance.OnFuncStateChangeEvent -= OnFuncStateChangeEvent;
+ }
+ private void SetState()
+ {
+ var IsOpen = FuncOpen.Instance.IsFuncOpen(funcOpenKey);
+ var _funcOpenCfg = FuncOpenLVConfig.Get(funcOpenKey);
+
+ if (_funcOpenCfg == null)
{
- if (funcOpenKey == func)
- {
- SetState();
- }
+ IsOpen = true;
+ active = true;
}
- private void OnDestroy()
+ if (funcBtn != null)
{
- FuncOpen.Instance.OnFuncStateChangeEvent -= OnFuncStateChangeEvent;
+ funcBtn.interactable = IsOpen;
}
- private void SetState()
+
+
+ if (LockImg != null)
{
- var IsOpen = FuncOpen.Instance.IsFuncOpen(funcOpenKey);
- var _funcOpenCfg = FuncOpenLVConfig.Get(funcOpenKey);
+ LockImg.SetActive(!IsOpen);
+ }
- if (_funcOpenCfg == null)
- {
- IsOpen = true;
- active = true;
- }
+ // 鏈紑鍚槸鍚︽樉绀虹殑閰嶇疆
+ // if (_funcOpenCfg != null && _funcOpenCfg.open == 0)
+ // {
+ // gameObject.SetActive(false);
+ // return;
+ // }
- if (funcBtn != null)
+ if (!active)
+ {
+ gameObject.SetActive(IsOpen);
+ }
+ else
+ {
+ if (!gameObject.activeSelf)
{
- funcBtn.interactable = IsOpen;
- }
-
-
- if (LockImg != null)
- {
- LockImg.SetActive(!IsOpen);
- }
-
- if (_funcOpenCfg != null && _funcOpenCfg.open == 0)
- {
- gameObject.SetActive(false);
- return;
- }
-
- if (!active)
- {
- gameObject.SetActive(IsOpen);
- }
- else
- {
- if (!gameObject.activeSelf)
- {
- gameObject.SetActive(true);
- }
+ gameObject.SetActive(true);
}
}
- }
\ No newline at end of file
+ }
+}
\ No newline at end of file
diff --git a/Main/Config/Configs/FuncOpenLVConfig.cs b/Main/Config/Configs/FuncOpenLVConfig.cs
index 49baa97..880e8a1 100644
--- a/Main/Config/Configs/FuncOpenLVConfig.cs
+++ b/Main/Config/Configs/FuncOpenLVConfig.cs
@@ -1,6 +1,6 @@
锘�//--------------------------------------------------------
// [Author]: YYL
-// [ Date ]: 2025骞�8鏈�20鏃�
+// [ Date ]: 2025骞�8鏈�28鏃�
//--------------------------------------------------------
using System.Collections.Generic;
@@ -20,11 +20,11 @@
public int LimitLV;
public int LimiRealmLV;
public int LimitMissionID;
+ public int OpenDay;
public string Name;
public string Desc;
- public string Tip;
public string Icon;
- public int open;
+ public Dictionary<int, int[][]> Award;
public override int LoadKey(string _key)
{
@@ -44,15 +44,15 @@
int.TryParse(tables[3],out LimitMissionID);
- Name = tables[4];
+ int.TryParse(tables[4],out OpenDay);
- Desc = tables[5];
+ Name = tables[5];
- Tip = tables[6];
+ Desc = tables[6];
Icon = tables[7];
- int.TryParse(tables[8],out open);
+ Award = ConfigParse.ParseIntArray2Dict(tables[8]);
}
catch (Exception exception)
{
diff --git a/Main/Config/Configs/HeroQualityConfig.cs b/Main/Config/Configs/HeroQualityConfig.cs
index f2d715c..41e7b5a 100644
--- a/Main/Config/Configs/HeroQualityConfig.cs
+++ b/Main/Config/Configs/HeroQualityConfig.cs
@@ -1,6 +1,6 @@
锘�//--------------------------------------------------------
// [Author]: YYL
-// [ Date ]: 2025骞�8鏈�7鏃�
+// [ Date ]: Thursday, August 28, 2025
//--------------------------------------------------------
using System.Collections.Generic;
@@ -17,7 +17,6 @@
}
public int Quality;
- public int[] UPCostItem;
public int InitStarUpper;
public int InitAddPer;
public int LVAddPer;
@@ -41,37 +40,23 @@
string[] tables = input.Split('\t');
int.TryParse(tables[0],out Quality);
- if (tables[1].Contains("["))
+ int.TryParse(tables[1],out InitStarUpper);
+
+ int.TryParse(tables[2],out InitAddPer);
+
+ int.TryParse(tables[3],out LVAddPer);
+
+ int.TryParse(tables[4],out BreakLVAddPer);
+
+ int.TryParse(tables[5],out StarAddPer);
+
+ if (tables[6].Contains("["))
{
- UPCostItem = JsonMapper.ToObject<int[]>(tables[1]);
+ BookActAwardMoney = JsonMapper.ToObject<int[]>(tables[6]);
}
else
{
- string[] UPCostItemStringArray = tables[1].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
- UPCostItem = new int[UPCostItemStringArray.Length];
- for (int i=0;i<UPCostItemStringArray.Length;i++)
- {
- int.TryParse(UPCostItemStringArray[i],out UPCostItem[i]);
- }
- }
-
- int.TryParse(tables[2],out InitStarUpper);
-
- int.TryParse(tables[3],out InitAddPer);
-
- int.TryParse(tables[4],out LVAddPer);
-
- int.TryParse(tables[5],out BreakLVAddPer);
-
- int.TryParse(tables[6],out StarAddPer);
-
- if (tables[7].Contains("["))
- {
- BookActAwardMoney = JsonMapper.ToObject<int[]>(tables[7]);
- }
- else
- {
- string[] BookActAwardMoneyStringArray = tables[7].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
+ string[] BookActAwardMoneyStringArray = tables[6].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
BookActAwardMoney = new int[BookActAwardMoneyStringArray.Length];
for (int i=0;i<BookActAwardMoneyStringArray.Length;i++)
{
@@ -79,13 +64,13 @@
}
}
- int.TryParse(tables[8],out BookInitAddPer);
+ int.TryParse(tables[7],out BookInitAddPer);
- int.TryParse(tables[9],out BookStarAddPer);
+ int.TryParse(tables[8],out BookStarAddPer);
- int.TryParse(tables[10],out BookBreakLVAddPer);
+ int.TryParse(tables[9],out BookBreakLVAddPer);
- DismissReturnItems = JsonMapper.ToObject<int[][]>(tables[11].Replace("(", "[").Replace(")", "]"));
+ DismissReturnItems = JsonMapper.ToObject<int[][]>(tables[10].Replace("(", "[").Replace(")", "]"));
}
catch (Exception exception)
{
diff --git a/Main/Core/NetworkPackage/ClientPack/C03_MainCharacter/C0303_tagCSetShutCutData.cs b/Main/Core/NetworkPackage/ClientPack/C03_MainCharacter/C0303_tagCSetShutCutData.cs
new file mode 100644
index 0000000..b7c175e
--- /dev/null
+++ b/Main/Core/NetworkPackage/ClientPack/C03_MainCharacter/C0303_tagCSetShutCutData.cs
@@ -0,0 +1,17 @@
+using UnityEngine;
+using System.Collections;
+
+//03 03 璁剧疆蹇嵎鏍忎繚瀛�#tagCSetShutCutData
+
+public class C0303_tagCSetShutCutData : GameNetPackBasic {
+ public string Setting;
+
+ public C0303_tagCSetShutCutData () {
+ _cmd = (ushort)0x0303;
+ }
+
+ public override void WriteToBytes () {
+ WriteBytes (Setting, NetDataType.Chars, 100);
+ }
+
+}
diff --git a/Main/Component/UI/Common/FuncEnable.cs.meta b/Main/Core/NetworkPackage/ClientPack/C03_MainCharacter/C0303_tagCSetShutCutData.cs.meta
similarity index 68%
copy from Main/Component/UI/Common/FuncEnable.cs.meta
copy to Main/Core/NetworkPackage/ClientPack/C03_MainCharacter/C0303_tagCSetShutCutData.cs.meta
index 383dea1..76a89a8 100644
--- a/Main/Component/UI/Common/FuncEnable.cs.meta
+++ b/Main/Core/NetworkPackage/ClientPack/C03_MainCharacter/C0303_tagCSetShutCutData.cs.meta
@@ -1,8 +1,7 @@
fileFormatVersion: 2
-guid: e034d1a3f772bb44bbbcd4273f5084e1
-timeCreated: 1516430103
-licenseType: Free
+guid: 35992e06ad8ed6049bbfca868849f3d1
MonoImporter:
+ externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
diff --git a/Main/Core/NetworkPackage/DTCFile/ServerPack/H01_System/DTC0102_tagCDBPlayer.cs b/Main/Core/NetworkPackage/DTCFile/ServerPack/H01_System/DTC0102_tagCDBPlayer.cs
index e1151d7..a87c36f 100644
--- a/Main/Core/NetworkPackage/DTCFile/ServerPack/H01_System/DTC0102_tagCDBPlayer.cs
+++ b/Main/Core/NetworkPackage/DTCFile/ServerPack/H01_System/DTC0102_tagCDBPlayer.cs
@@ -37,7 +37,7 @@
PlayerDatas.Instance.InitPlayerData(package);
PlayerDatas.Instance.RequestWorldTick();
-
+ QuickSetting.Instance.SetQuickSetting(package.Setting);
if (playerIdBuf != 0 && playerIdBuf != PlayerDatas.Instance.baseData.PlayerID)
{
if (switchAccountEvent != null)
diff --git a/Main/Main.cs b/Main/Main.cs
index c7a1e90..7e634a8 100644
--- a/Main/Main.cs
+++ b/Main/Main.cs
@@ -77,6 +77,7 @@
managers.Add(HeroUIManager.Instance);
managers.Add(InvestModel.Instance);
managers.Add(BlessLVManager.Instance);
+ managers.Add(AutoFightModel.Instance);
foreach (var manager in managers)
{
diff --git a/Main/System/CustomizedGift/CustomizedGiftModel.cs b/Main/System/CustomizedGift/CustomizedGiftModel.cs
index e1e8096..d4cfe40 100644
--- a/Main/System/CustomizedGift/CustomizedGiftModel.cs
+++ b/Main/System/CustomizedGift/CustomizedGiftModel.cs
@@ -127,7 +127,7 @@
for (int i = 0; i < act.ctgIDs.Count; i++)
{
int ctgID = act.ctgIDs[i];
- RechargeManager.RechargeCount rechargeCount;
+ RechargeCount rechargeCount;
if (RechargeManager.Instance.TryGetRechargeCount(ctgID, out rechargeCount))
{
total += rechargeCount.totalCount;
@@ -142,7 +142,7 @@
OperationRechargeGiftAct act;
OperationTimeHepler.Instance.TryGetOperation(operaType, out act);
- RechargeManager.RechargeCount rechargeCount;
+ RechargeCount rechargeCount;
RechargeManager.Instance.TryGetRechargeCount(ctgID, out rechargeCount);
var ctgConfig = CTGConfig.Get(ctgID);
diff --git a/Main/System/CustomizedGift/CustomizedRechargeModel.cs b/Main/System/CustomizedGift/CustomizedRechargeModel.cs
index 261be8f..dd09e16 100644
--- a/Main/System/CustomizedGift/CustomizedRechargeModel.cs
+++ b/Main/System/CustomizedGift/CustomizedRechargeModel.cs
@@ -30,7 +30,7 @@
if (!RechargeManager.Instance.TryGetRechargeItem(ctgId, out awards))
return false;
- RechargeManager.RechargeCount rechargeCount;
+ RechargeCount rechargeCount;
if (!RechargeManager.Instance.TryGetRechargeCount(ctgId, out rechargeCount))
{
return false;
@@ -101,7 +101,7 @@
public void InitChoose()
{
- RechargeManager.RechargeCount rechargeCount;
+ RechargeCount rechargeCount;
RechargeManager.Instance.TryGetRechargeCount(chooseCTGID, out rechargeCount);
var selectedItemIndexs = CustomizedRechargeModel.Instance.GetSelectedItems(rechargeCount.selectItemValue);
@@ -132,7 +132,7 @@
int goodsSumCount; //鍟嗗搧鎬绘暟閲�
List<Item> awards = new List<Item>();
TryGetRechargeItemEx(ctgID, out awards, out goodsCount, out goodsSumCount);
- RechargeManager.RechargeCount rechargeCount;
+ RechargeCount rechargeCount;
RechargeManager.Instance.TryGetRechargeCount(ctgID, out rechargeCount);
for (int i = 0; i < itemCells.Count; i++)
{
diff --git a/Main/System/Equip/EquipModel.cs b/Main/System/Equip/EquipModel.cs
index 5cf7211..b4c4148 100644
--- a/Main/System/Equip/EquipModel.cs
+++ b/Main/System/Equip/EquipModel.cs
@@ -9,7 +9,7 @@
public class EquipModel : GameSystemManager<EquipModel>
{
public const int TotleEquip = 12; //瑁呭鏍忓ぇ灏�
- public bool waitEquipOPPack = false;
+ public bool waitEquipOPPack = false; // 绌挎埓瑁呭鐨勬搷浣� 涓嶅惈鍒嗚В
public event Action<bool, int> OnEquipOPResultAction; //鏄惁鎹笂浜嗘柊瑁呭涓斿垎瑙d簡 瑁呭绱㈠紩
public event Action<List<int>, RectTransform> OnItemDropEvent;
@@ -23,7 +23,7 @@
public int[] equipUIGirdEffects; //瑁呭鏍煎瓙鐗规晥
public ItemModel selectFloorEquip; //閫変腑鐨勫湴鏉胯澶�
public int lastShowEquipIndex = -1; //涓婁竴娆$晫闈㈡樉绀鸿澶囩殑绱㈠紩锛屾嬀鍙栧悗鐗╁搧娑堝け闇�璁板綍涓嬪仛琛ㄧ幇
- public Queue<int> waitEquipOP = new Queue<int>(); //绛夊緟鎿嶄綔鐨勮澶囷紝闇�瑕佸拰UI浜や簰纭
+ public Queue<int> waitEquipOP = new Queue<int>(); //绛夊緟鎿嶄綔鐨勮澶囷紝闇�瑕佸拰UI浜や簰纭 涓嶅惈鍒嗚В
public override void Init()
{
@@ -238,6 +238,13 @@
// if (!IsEquip(equip))
// return false;
+ if (AutoFightModel.Instance.TryAutoFightDoEquip(equip))
+ {
+ //鑷姩鎴樺姏瀵规瘮, 鏉′欢涓嶆弧瓒崇殑鍒嗚В
+ return false;
+ }
+
+ // 濂藉嚑浠惰澶囬渶瑕佸鐞嗙殑鎯呭喌瀛樿捣鏉�
waitEquipOP.Enqueue(equip.gridIndex);
//鏈洖澶嶈澶囨搷浣滅粨鏋滐紝鍚﹀垯浼氭樉绀烘棫瑁呭
if (waitEquipOPPack)
@@ -252,10 +259,12 @@
return false;
}
-
+
selectFloorEquip = GetSelectFloorEquip();
+ if (selectFloorEquip == null)
+ return false;
+
UIManager.Instance.OpenWindow<EquipExchangeWin>();
-
return true;
}
@@ -266,18 +275,12 @@
if (waitEquipOP.Count == 0)
return null;
- ItemModel item = PackManager.Instance.GetItemByIndex(PackType.DropItem, waitEquipOP.Dequeue());
- if (AutoFightModel.Instance.isAutoAttack)
- {
- //鑷姩鎴樺姏瀵规瘮, 鏉′欢涓嶆弧瓒崇殑鍒嗚В
- return null;
+ return PackManager.Instance.GetItemByIndex(PackType.DropItem, waitEquipOP.Dequeue());
- }
-
- return item;
}
+
//绛夌骇
public int GetEquipLV(ItemModel equip)
{
diff --git a/Main/System/Login/LoginWin.cs b/Main/System/Login/LoginWin.cs
index 9599d70..282de81 100644
--- a/Main/System/Login/LoginWin.cs
+++ b/Main/System/Login/LoginWin.cs
@@ -99,6 +99,7 @@
// InGameDownLoad.Instance.downLoadGo = false;
// DownloadMgr.MaxDownLoadTask = InGameDownLoad.Instance.GetMaxTask();
// });
+ AutoFightModel.Instance.isAutoAttack = false;
}
protected override void OnOpenAnimationComplete()
@@ -124,9 +125,9 @@
public override void Refresh()
{
base.Refresh();
- Debug.Log("鍒锋柊鐧诲綍绐楀彛");
-
- //鎵撳寘鐗堟湰 + 鍔熻兘鐗堟湰 + 璇█ID
+ Debug.Log("鍒锋柊鐧诲綍绐楀彛");
+
+ //鎵撳寘鐗堟湰 + 鍔熻兘鐗堟湰 + 璇█ID
verInfo.text = LoginManager.Instance.GetVersionStr();
var sprite = BuiltInLoader.LoadSprite("TB_DL_Logo");
diff --git a/Main/System/Main/AutoFightModel.cs b/Main/System/Main/AutoFightModel.cs
index 1439254..d39634f 100644
--- a/Main/System/Main/AutoFightModel.cs
+++ b/Main/System/Main/AutoFightModel.cs
@@ -2,25 +2,133 @@
using System.Collections;
using System.Collections.Generic;
using System.Text;
+using LitJson;
using UnityEngine;
public class AutoFightModel : GameSystemManager<AutoFightModel>
{
- public int fightSpeed = 1; //鎴樻枟鍊嶆暟锛氬�艰秺澶ц秺蹇紝褰卞搷鎴樻枟琛ㄧ幇锛屾帀钀介�熷害绛�
+ //鎴樻枟鍊嶆暟锛氬�艰秺澶ц秺蹇紝褰卞搷鎴樻枟琛ㄧ幇锛屾帀钀介�熷害绛�
+ public int fightSpeed
+ {
+ get
+ {
+ int value = QuickSetting.Instance.GetQuickSettingValue<int>(QuickSettingType.AutoFight_Speed, 0);
+ return Math.Min(Math.Max(value, 1), maxSpeed);
+ }
+ set
+ {
+ QuickSetting.Instance.SetQuickSetting(QuickSettingType.AutoFight_Speed, value);
+ }
+ }
- public bool isAutoAttack; //鑷姩鏀诲嚮
+ //娑堣�楀�嶆暟
+ public int fightCost
+ {
+ get
+ {
+ int value = QuickSetting.Instance.GetQuickSettingValue<int>(QuickSettingType.AutoFight_Cost, 0);
+ return Math.Min(Math.Max(value, 1), maxCost);
+ }
+ set
+ {
+ QuickSetting.Instance.SetQuickSetting(QuickSettingType.AutoFight_Cost, value);
+ }
+ }
+
+ //鑷姩妯″紡, 鐪熸鐐瑰嚮鎴橀敜娑堣�楀紑鍚紝鍜屼紤鎭紙鎴栨棤鏉愭枡锛夊仠姝�
+ public bool isAutoAttack = false;
+
+ //鏄惁寮�鍚嚜鍔ㄦ垬鏂楄缃�
+ public bool isAutoAttackSet
+ {
+ get
+ {
+ return QuickSetting.Instance.GetQuickSettingBool(QuickSettingType.AutoFight_Open, 0);
+ }
+ set
+ {
+ QuickSetting.Instance.SetQuickSetting(QuickSettingType.AutoFight_Open, value);
+ }
+ }
+
+ //鏇村ソ瑁呭鍋滄鎴樻枟
+ public bool isStopFightByBetterEquip
+ {
+ get
+ {
+ return QuickSetting.Instance.GetQuickSettingBool(QuickSettingType.AutoFight_FightPower, 0);
+ }
+ set
+ {
+ QuickSetting.Instance.SetQuickSetting(QuickSettingType.AutoFight_FightPower, value);
+ }
+ }
+
+
+ public event Action ChangeAutoEvent;
+
+ public int maxSpeed = 3; //鏈�楂橀�熷害
+ public int maxCost; //鏈�楂樻秷鑰�
+ public int[] autoCostWithBlessLV; //鑷姩鎴樻枟娑堣�楀�嶆暟鍏宠仈绁濈绛夌骇
+ public int speed2UnlockMissionID;
+ public int speed3UnlockCTGID;
public override void Init()
{
-
+ ParseConfig();
+ DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent += OnPlayerLoginOk;
}
public override void Release()
{
-
+ DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent -= OnPlayerLoginOk;
}
void ParseConfig()
{
+ var config = FuncConfigConfig.Get("AutoGuaji");
+ autoCostWithBlessLV = JsonMapper.ToObject<int[]>(config.Numerical1);
+ speed2UnlockMissionID = int.Parse(config.Numerical2);
+ speed3UnlockCTGID = int.Parse(config.Numerical3);
+ maxCost = autoCostWithBlessLV.Length;
}
+ void OnPlayerLoginOk()
+ {
+ //鐧诲綍鏃舵湁瑁呭鐨勫鐞�
+ }
+
+ public void SaveAutoFightSetting()
+ {
+ QuickSetting.Instance.SendPackage();
+ ChangeAutoEvent?.Invoke();
+ }
+
+
+ //鑷姩澶勭悊瑁呭锛岄渶瑕佺瓑寰呯┛鎴磋繑鍥瀎alse锛屽叾浠栨儏鍐佃繑鍥瀟rue
+ public bool TryAutoFightDoEquip(ItemModel item)
+ {
+ if (!isAutoAttack)
+ return false;
+
+ if (item == null)
+ return true;
+
+ long showFightPower = FightPowerManager.Instance.GetFightPowerChange(item);
+
+ if (showFightPower < 0)
+ {
+ EquipModel.Instance.SendEquipOP(new ushort[] { (ushort)item.gridIndex }, 1);
+ return true;
+ }
+ else
+ {
+ if (isStopFightByBetterEquip)
+ return false;
+
+ EquipModel.Instance.SendEquipOP(new ushort[] { (ushort)item.gridIndex }, 1);
+ return true;
+
+ }
+
+ }
}
diff --git a/Main/System/Main/AutoFightWin.cs b/Main/System/Main/AutoFightWin.cs
new file mode 100644
index 0000000..6a915e5
--- /dev/null
+++ b/Main/System/Main/AutoFightWin.cs
@@ -0,0 +1,244 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.UI;
+
+
+public class AutoFightWin : UIBase
+{
+ [SerializeField] Button autoStartBtn;
+ [SerializeField] GameObject usingAutoObj;
+ [SerializeField] Button autoStopBtn;
+ [SerializeField] Button autoSaveBtn;
+
+ [SerializeField] Button changeCostBtn;
+ [SerializeField] Text costText;
+ [SerializeField] Image costArrow;
+ [SerializeField] Text costTip;
+ [SerializeField] ScrollerController costScroll;
+
+ [SerializeField] Button changeSpeedBtn;
+ [SerializeField] Text speedText;
+ [SerializeField] Image speedArrow;
+ [SerializeField] ScrollerController speedScroll;
+
+ [SerializeField] Toggle betterEquipToggle;
+
+
+ bool isOpenCostScroll = false;
+ bool isOpenSpeedScroll = false;
+ protected override void InitComponent()
+ {
+ autoStartBtn.AddListener(OnClickAutoStart);
+ autoStopBtn.AddListener(OnClickAutoStop);
+ autoSaveBtn.AddListener(OnClickAutoStart);
+
+ changeCostBtn.AddListener(() =>
+ {
+ isOpenCostScroll = !isOpenCostScroll;
+ costScroll.SetActive(isOpenCostScroll);
+ costArrow.transform.localRotation = Quaternion.Euler(0, 0, isOpenCostScroll ? 180 : 0);
+ });
+ changeSpeedBtn.AddListener(() =>
+ {
+ isOpenSpeedScroll = !isOpenSpeedScroll;
+ speedScroll.SetActive(isOpenSpeedScroll);
+ speedArrow.transform.localRotation = Quaternion.Euler(0, 0, isOpenSpeedScroll ? 180 : 0);
+ });
+
+ betterEquipToggle.AddListener((bool value) =>
+ {
+ betterEquipToggle.isOn = value;
+ });
+
+ costScroll.GetComponent<ClickScreenOtherSpace>().AddListener(() =>
+ {
+ isOpenCostScroll = false;
+ costArrow.transform.localRotation = Quaternion.Euler(0, 0, 0);
+ });
+
+ speedScroll.GetComponent<ClickScreenOtherSpace>().AddListener(() =>
+ {
+ isOpenSpeedScroll = false;
+ speedArrow.transform.localRotation = Quaternion.Euler(0, 0, 0);
+ });
+ }
+
+ protected override void OnPreOpen()
+ {
+ costScroll.OnRefreshCell += OnRefreshCostCell;
+ speedScroll.OnRefreshCell += OnRefreshSpeedCell;
+ Display();
+ }
+
+ protected override void OnPreClose()
+ {
+ costScroll.OnRefreshCell -= OnRefreshCostCell;
+ speedScroll.OnRefreshCell -= OnRefreshSpeedCell;
+ }
+
+
+ void Display()
+ {
+ costText.text = AutoFightModel.Instance.fightCost.ToString();
+ speedText.text = AutoFightModel.Instance.fightSpeed.ToString();
+ betterEquipToggle.isOn = AutoFightModel.Instance.isStopFightByBetterEquip;
+ costTip.text = Language.Get("AutoFight2", ItemConfig.Get(GeneralDefine.MoneyDisplayModel[41]).ItemName, AutoFightModel.Instance.fightCost);
+
+ if (AutoFightModel.Instance.isAutoAttackSet)
+ {
+ usingAutoObj.SetActive(true);
+ autoStartBtn.SetActive(false);
+ }
+ else
+ {
+ usingAutoObj.SetActive(false);
+ autoStartBtn.SetActive(true);
+ }
+
+ costScroll.SetActive(false);
+ speedScroll.SetActive(false);
+ costArrow.transform.localRotation = Quaternion.Euler(0, 0, 0);
+ speedArrow.transform.localRotation = Quaternion.Euler(0, 0, 0);
+
+ CreateCostScroll();
+ CreateSpeedScroll();
+
+ }
+
+
+ void CreateCostScroll()
+ {
+ costScroll.Refresh();
+ for (int i = 0; i < AutoFightModel.Instance.maxCost; i++)
+ {
+ costScroll.AddCell(ScrollerDataType.Header, i + 1);
+ }
+ costScroll.Restart();
+ }
+
+ void CreateSpeedScroll()
+ {
+ speedScroll.Refresh();
+ for (int i = 0; i < AutoFightModel.Instance.maxSpeed; i++)
+ {
+ speedScroll.AddCell(ScrollerDataType.Header, i + 1);
+ }
+ speedScroll.Restart();
+ }
+
+
+ void OnRefreshCostCell(ScrollerDataType type, CellView cell)
+ {
+ var btn = cell.GetComponent<Button>();
+
+ btn.AddListener(() =>
+ {
+ if (AutoFightModel.Instance.autoCostWithBlessLV[cell.index - 1] > BlessLVManager.Instance.m_TreeLV)
+ {
+ SysNotifyMgr.Instance.ShowTip("autofight4", AutoFightModel.Instance.autoCostWithBlessLV[cell.index - 1]);
+ return;
+ }
+ isOpenCostScroll = false;
+ costScroll.SetActive(false);
+ costArrow.transform.localRotation = Quaternion.Euler(0, 0, 0);
+ costText.text = cell.index.ToString();
+ costTip.text = Language.Get("AutoFight2", ItemConfig.Get(GeneralDefine.MoneyDisplayModel[41]).ItemName, cell.index);
+
+ });
+
+
+
+ var cntText = cell.GetComponentInChildren<Text>();
+
+ if (AutoFightModel.Instance.autoCostWithBlessLV[cell.index - 1] <= BlessLVManager.Instance.m_TreeLV)
+ {
+ cntText.text = UIHelper.AppendColor(TextColType.LightWhite, cell.index.ToString());
+ }
+ else
+ {
+ cntText.text = UIHelper.AppendColor(TextColType.Gray, cell.index.ToString());
+ }
+ }
+
+
+ void OnRefreshSpeedCell(ScrollerDataType type, CellView cell)
+ {
+ var btn = cell.GetComponent<Button>();
+ var needtaskCount = TaskManager.Instance.GetNeedFinishTaskCount(AutoFightModel.Instance.speed2UnlockMissionID);
+ RechargeCount _rechargeCount;
+ bool isbuy = false;
+ if (RechargeManager.Instance.TryGetRechargeCount(AutoFightModel.Instance.speed3UnlockCTGID, out _rechargeCount))
+ {
+ isbuy = _rechargeCount.totalCount > 0;
+ }
+
+
+ btn.AddListener(() =>
+ {
+ if (cell.index == 2)
+ {
+ if (needtaskCount > 0)
+ {
+ SysNotifyMgr.Instance.ShowTip("autofight2", needtaskCount);
+ return;
+ }
+ }
+ else if (cell.index == 3)
+ {
+ if (!isbuy)
+ {
+ SysNotifyMgr.Instance.ShowTip("autofight3");
+ return;
+ }
+ }
+ isOpenSpeedScroll = false;
+ speedScroll.SetActive(false);
+ speedArrow.transform.localRotation = Quaternion.Euler(0, 0, 0);
+ speedText.text = cell.index.ToString();
+ });
+
+ var cntText = cell.GetComponentInChildren<Text>();
+ if (cell.index == 2)
+ {
+ cntText.text = UIHelper.AppendColor(needtaskCount > 0 ? TextColType.Gray : TextColType.LightWhite, cell.index.ToString());
+ }
+ else if (cell.index == 3)
+ {
+ cntText.text = UIHelper.AppendColor(isbuy ? TextColType.LightWhite : TextColType.Gray, cell.index.ToString());
+ }
+ else
+ {
+ cntText.text = cell.index.ToString();
+ }
+ }
+
+ void OnClickAutoStart()
+ {
+ AutoFightModel.Instance.isAutoAttackSet = true;
+ AutoFightModel.Instance.fightCost = int.Parse(costText.text);
+ AutoFightModel.Instance.fightSpeed = int.Parse(speedText.text);
+ AutoFightModel.Instance.isStopFightByBetterEquip = betterEquipToggle.isOn;
+ AutoFightModel.Instance.SaveAutoFightSetting();
+ CloseWindow();
+ SysNotifyMgr.Instance.ShowTip("autofight1");
+ }
+
+ void OnClickAutoStop()
+ {
+ ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"),
+ Language.Get("AutoFight11"), (bool isOK) =>
+ {
+ if (isOK)
+ {
+ AutoFightModel.Instance.isAutoAttackSet = false;
+ AutoFightModel.Instance.fightCost = int.Parse(costText.text);
+ AutoFightModel.Instance.fightSpeed = int.Parse(speedText.text);
+ AutoFightModel.Instance.isStopFightByBetterEquip = betterEquipToggle.isOn;
+ AutoFightModel.Instance.SaveAutoFightSetting();
+ CloseWindow();
+ }
+ });
+
+ }
+}
\ No newline at end of file
diff --git a/Main/Component/UI/Common/FuncEnable.cs.meta b/Main/System/Main/AutoFightWin.cs.meta
similarity index 68%
copy from Main/Component/UI/Common/FuncEnable.cs.meta
copy to Main/System/Main/AutoFightWin.cs.meta
index 383dea1..b726019 100644
--- a/Main/Component/UI/Common/FuncEnable.cs.meta
+++ b/Main/System/Main/AutoFightWin.cs.meta
@@ -1,8 +1,7 @@
fileFormatVersion: 2
-guid: e034d1a3f772bb44bbbcd4273f5084e1
-timeCreated: 1516430103
-licenseType: Free
+guid: eb3b2c8794aa61c4c95ea434c6baebbc
MonoImporter:
+ externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
diff --git a/Main/System/Main/HomeWin.cs b/Main/System/Main/HomeWin.cs
index 6ec10e7..eefb2ad 100644
--- a/Main/System/Main/HomeWin.cs
+++ b/Main/System/Main/HomeWin.cs
@@ -33,6 +33,8 @@
//搴曢儴鍔熻兘
[SerializeField] Button autoBtn;
+ [SerializeField] Image autoCloseImg;
+ [SerializeField] UIEffectPlayer autoOpenEffect;
[SerializeField] Button blessLVBtn;
[SerializeField] Text blessLVText;
@@ -58,25 +60,30 @@
autoBtn.AddListener(() =>
{
- //娴嬭瘯鎷惧彇鎵�鏈夌墿鍝�
- var items = PackManager.Instance.GetItems(PackType.DropItem);
- List<int> dropindexs = new List<int>();
- for (int i = 0; i < items.Count; i++)
- {
- var item = items[i];
- if (dropindexs.Count > 5)
- {
- EquipModel.Instance.NotifyItemDrop(dropindexs, BattleManager.Instance.storyBattleField.battleRootNode.blueTeamNodeList[Random.Range(0, 5)].GetComponent<RectTransform>());
- dropindexs.Clear();
- }
+ // //娴嬭瘯鎷惧彇鎵�鏈夌墿鍝�
+ // var items = PackManager.Instance.GetItems(PackType.DropItem);
+ // List<int> dropindexs = new List<int>();
+ // for (int i = 0; i < items.Count; i++)
+ // {
+ // var item = items[i];
+ // if (dropindexs.Count > 5)
+ // {
+ // EquipModel.Instance.NotifyItemDrop(dropindexs, BattleManager.Instance.storyBattleField.battleRootNode.blueTeamNodeList[Random.Range(0, 5)].GetComponent<RectTransform>());
+ // dropindexs.Clear();
+ // }
- dropindexs.Add(item.gridIndex);
- }
- if (dropindexs.Count > 0)
+ // dropindexs.Add(item.gridIndex);
+ // }
+ // if (dropindexs.Count > 0)
+ // {
+ // EquipModel.Instance.NotifyItemDrop(dropindexs, BattleManager.Instance.storyBattleField.battleRootNode.blueTeamNodeList[Random.Range(0, 5)].GetComponent<RectTransform>());
+ // dropindexs.Clear();
+ // }
+ if (!FuncOpen.Instance.IsFuncOpen(108, true))
{
- EquipModel.Instance.NotifyItemDrop(dropindexs, BattleManager.Instance.storyBattleField.battleRootNode.blueTeamNodeList[Random.Range(0, 5)].GetComponent<RectTransform>());
- dropindexs.Clear();
+ return;
}
+ UIManager.Instance.OpenWindow<AutoFightWin>();
});
@@ -107,6 +114,7 @@
UpdateTask();
RefreshRecharge();
ShowBlessLV();
+ DisplayAutoFight();
}
protected override void OnPreOpen()
@@ -114,6 +122,7 @@
PlayerDatas.Instance.playerDataRefreshEvent += PlayerDataRefresh;
TaskManager.Instance.OnTaskUpdate += UpdateTask;
BlessLVManager.Instance.OnBlessLVUpdateEvent += ShowBlessLV;
+ AutoFightModel.Instance.ChangeAutoEvent += DisplayAutoFight;
Display();
// var battleWin = UIManager.Instance.OpenWindow<BattleWin>();
// battleWin.SetBattleField(BattleManager.Instance.storyBattleField);
@@ -126,6 +135,7 @@
PlayerDatas.Instance.playerDataRefreshEvent -= PlayerDataRefresh;
TaskManager.Instance.OnTaskUpdate -= UpdateTask;
BlessLVManager.Instance.OnBlessLVUpdateEvent -= ShowBlessLV;
+ AutoFightModel.Instance.ChangeAutoEvent -= DisplayAutoFight;
// 鍏抽棴鐨勬椂鍊欐妸鎴樻枟鐣岄潰涔熺粰鍏充簡 铏界劧鏄湪澶栭潰寮�鐨�
UIManager.Instance.CloseWindow<BattleWin>();
@@ -157,6 +167,20 @@
{
blessLVText.text = BlessLVManager.Instance.m_TreeLV.ToString();
}
+
+ void DisplayAutoFight()
+ {
+ if (AutoFightModel.Instance.isAutoAttackSet)
+ {
+ autoCloseImg.SetActive(false);
+ autoOpenEffect.Play();
+ }
+ else
+ {
+ autoCloseImg.SetActive(true);
+ autoOpenEffect.Stop();
+ }
+ }
/// <summary>
/// 鏇存柊鐜╁淇℃伅
diff --git a/Main/System/Main/MainWin.cs b/Main/System/Main/MainWin.cs
index 97b6c00..f41d1c6 100644
--- a/Main/System/Main/MainWin.cs
+++ b/Main/System/Main/MainWin.cs
@@ -105,6 +105,10 @@
if (currentSubUI != null && currentSubUI.name == "HomeWin")
{
//鎵撳紑涓荤晫闈㈢殑鎯呭喌涓嬪啀鐐瑰嚮鎸夐挳锛屾墽琛屾敾鍑婚�昏緫
+ if (AutoFightModel.Instance.isAutoAttackSet)
+ {
+ AutoFightModel.Instance.isAutoAttack = true;
+ }
StoryBattleField storyBattleField = BattleManager.Instance.storyBattleField;
if (storyBattleField != null)
{
diff --git a/Main/System/Message/SysNotifyMgr.cs b/Main/System/Message/SysNotifyMgr.cs
index 0a2aa82..1e7710e 100644
--- a/Main/System/Message/SysNotifyMgr.cs
+++ b/Main/System/Message/SysNotifyMgr.cs
@@ -149,6 +149,7 @@
}
}
+ //淇℃伅鎻愮ず琛ㄧ殑鎻愮ず
public void ShowTip(string key, params object[] msg)
{
SysInfoConfig cfg = SysInfoConfig.Get(key);
@@ -159,11 +160,24 @@
AnalysisSysmsg(cfg);
}
else
- {
+ {
Debug.LogError("鏈壘鍒扮郴缁熸彁绀轰俊鎭�: " + key);
}
}
+ //璇█琛ㄧ殑鎻愮ず
+ public void ShowLangTip(string key, params object[] msg)
+ {
+ string hint = Language.Get(key, msg);
+ ScrollTip.ShowTip(hint);
+ }
+
+ //鐩存帴浼犳枃瀛楃殑鎻愮ず
+ public void ShowStringTip(string hint)
+ {
+ ScrollTip.ShowTip(hint);
+ }
+
void AnalysisSysmsg(SysInfoConfig cfg)
{
SysNotifySound(cfg.sound);
diff --git a/Main/System/Recharge/RechargeManager.cs b/Main/System/Recharge/RechargeManager.cs
index 603b5d9..74707d9 100644
--- a/Main/System/Recharge/RechargeManager.cs
+++ b/Main/System/Recharge/RechargeManager.cs
@@ -613,15 +613,6 @@
}
- public struct RechargeCount
- {
- public int todayCount;
- public int totalCount;
- public int weekPayCount;
- public int monthPayCount;
- public int selectItemValue;
-
- }
public int FirstGoldServerDay = 0; //0琛ㄧず鏈厖鍊硷紝棣栧厖鏃朵负寮�鏈嶇鍑犲ぉ锛坥penday+1锛�
@@ -768,3 +759,12 @@
}
+public struct RechargeCount
+{
+ public int todayCount;
+ public int totalCount;
+ public int weekPayCount;
+ public int monthPayCount;
+ public int selectItemValue;
+
+}
diff --git a/Main/System/Setting.meta b/Main/System/Setting.meta
new file mode 100644
index 0000000..f6ad9bf
--- /dev/null
+++ b/Main/System/Setting.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 629835bc583036c41a4e9cb04fc4fdb7
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Main/System/Setting/QuickSetting.cs b/Main/System/Setting/QuickSetting.cs
new file mode 100644
index 0000000..2a8972a
--- /dev/null
+++ b/Main/System/Setting/QuickSetting.cs
@@ -0,0 +1,166 @@
+锘縰sing System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using System.Text;
+using System;
+using System.Text.RegularExpressions;
+/// <summary>
+/// 鏈嶅姟绔疭etting閰嶇疆锛屽瓨鍌ㄤ竴浜涘揩鎹疯缃紝鐩墠闀垮害涓�100
+/// </summary>
+
+public class QuickSetting : Singleton<QuickSetting>
+{
+ public QuickSetting()
+ {
+ //鑷姩鎴樻枟 鍑犲�嶆秷鑰� 鍑犲�嶉�熷害 鏄惁楂樻垬鍔涘仠姝� 鏄惁寮�鍚嚜鍔ㄦ垬鏂�
+ quickSettingDic.Add(QuickSettingType.AutoFight_Cost, new QuickSettingRange(QuickSettingType.AutoFight_Cost, 0, 1));
+ quickSettingDic.Add(QuickSettingType.AutoFight_Speed, new QuickSettingRange(QuickSettingType.AutoFight_Speed, 1, 1));
+ quickSettingDic.Add(QuickSettingType.AutoFight_FightPower, new QuickSettingRange(QuickSettingType.AutoFight_FightPower, 2, 1));
+ quickSettingDic.Add(QuickSettingType.AutoFight_Open, new QuickSettingRange(QuickSettingType.AutoFight_Open, 3, 1));
+ setting = new string(UCharacter, 100);
+ DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += BeforePlayerDataInitializeEvent;
+ }
+
+ public Dictionary<QuickSettingType, QuickSettingRange> quickSettingDic = new Dictionary<QuickSettingType, QuickSettingRange>();
+ public const char UCharacter = '*';
+ private string setting;
+ private string cacheSetting;
+ private StringBuilder textBuilder = new StringBuilder();
+
+ public event Action onQuickSettingUpdate;
+
+ public void SetQuickSetting<T>(QuickSettingType type, T value, int index = 0) where T : struct
+ {
+ SetQuickSetting(type, value.ToString(), index);
+ }
+ public void SetQuickSetting(QuickSettingType type, bool value, int index = 0)
+ {
+ SetQuickSetting<int>(type, value ? 1 : 0, index);
+ }
+
+ public void SetQuickSetting(int type, string value, int index)
+ {
+ SetQuickSetting((QuickSettingType)type, value, index);
+ }
+
+ public void SetQuickSetting(QuickSettingType type, string value, int index)
+ {
+ var quickRange = quickSettingDic[type];
+
+
+ if ((index - quickRange.index) * quickRange.single + value.Length > quickRange.length || value.Length > quickRange.single)
+ {
+ Debug.LogErrorFormat("瀛樺偍鐨勬暟鎹秴杩囨渶澶ч暱搴�!{0}", type);
+ return;
+ }
+ textBuilder.Length = 0;
+ var start = quickRange.index + index * quickRange.single;
+ var end = start + value.Length;
+ if (quickRange.length == quickRange.single)
+ {
+ end = start + quickRange.length;
+ }
+ textBuilder.Append(setting, 0, start);
+ textBuilder.Append(value);
+ if (quickRange.length == quickRange.single
+ && quickRange.length > value.Length)
+ {
+ textBuilder.Append('*', quickRange.length - value.Length);
+ }
+ textBuilder.Append(setting, end, setting.Length - end);
+ setting = textBuilder.ToString();
+ PlayerDatas.Instance.baseData.Setting = setting;
+ }
+ public void SetQuickSetting(string value)
+ {
+ value = UIHelper.ServerStringTrim(value);
+ if (value != null && value.Length > 0)
+ {
+ setting = StringUtility.Contact(value, setting.Substring(value.Length, setting.Length - value.Length));
+ cacheSetting = setting;
+ PlayerDatas.Instance.baseData.Setting = setting;
+ }
+
+ if (onQuickSettingUpdate != null)
+ {
+ onQuickSettingUpdate();
+ }
+ }
+
+ public T GetQuickSettingValue<T>(QuickSettingType type, int index) where T : struct
+ {
+ string destinationStr = GetQuickSetting(type, index);
+ if (string.IsNullOrEmpty(destinationStr))
+ {
+ return default(T);
+ }
+ return (T)Convert.ChangeType(destinationStr, typeof(T));
+ }
+ public string GetQuickSetting(QuickSettingType type, int index)
+ {
+ var quickRange = quickSettingDic[type];
+ var start = quickRange.index + index * quickRange.single;
+ var destinationStr = setting.Substring(start, quickRange.single);
+ destinationStr = Regex.Replace(destinationStr, @"\*", string.Empty);
+ return destinationStr;
+ }
+ public bool GetQuickSettingBool(QuickSettingType type, int index, bool _default = false)
+ {
+ string destinationStr = GetQuickSetting(type, index);
+ if (string.IsNullOrEmpty(destinationStr))
+ {
+ return _default;
+ }
+ int _value = _default ? 1 : 0;
+ int.TryParse(destinationStr, out _value);
+ return _value == 1;
+ }
+
+ public string GetQuickSetting(int type, int index)
+ {
+ return GetQuickSetting((QuickSettingType)type, index);
+ }
+
+ public void SendPackage()
+ {
+ if (cacheSetting != setting)
+ {
+ cacheSetting = setting;
+ C0303_tagCSetShutCutData vNetData = new C0303_tagCSetShutCutData();
+ vNetData.Setting = setting;
+ GameNetSystem.Instance.SendInfo(vNetData);
+ }
+ }
+
+ private void BeforePlayerDataInitializeEvent()
+ {
+ setting = null;
+ setting = new string(UCharacter, 100);
+ PlayerDatas.Instance.baseData.Setting = setting;
+ }
+
+}
+
+public enum QuickSettingType
+{
+ AutoFight_Cost, //鑷姩鎴樻枟 鍑犲�嶆秷鑰�
+ AutoFight_Speed, //鍑犲�嶉�熷害
+ AutoFight_FightPower, //鏄惁楂樻垬鍔涘仠姝�
+ AutoFight_Open, //鏄惁寮�鍚嚜鍔ㄦ垬鏂�
+}
+
+public class QuickSettingRange
+{
+ public QuickSettingType type;
+ public int index;
+ public int length;
+ public int single;
+
+ public QuickSettingRange(QuickSettingType type, int start, int length, int single = 0)
+ {
+ this.type = type;
+ this.index = start;
+ this.length = length;
+ this.single = single == 0 ? length : single;
+ }
+}
\ No newline at end of file
diff --git a/Main/Component/UI/Common/FuncEnable.cs.meta b/Main/System/Setting/QuickSetting.cs.meta
similarity index 68%
rename from Main/Component/UI/Common/FuncEnable.cs.meta
rename to Main/System/Setting/QuickSetting.cs.meta
index 383dea1..6bea296 100644
--- a/Main/Component/UI/Common/FuncEnable.cs.meta
+++ b/Main/System/Setting/QuickSetting.cs.meta
@@ -1,8 +1,7 @@
fileFormatVersion: 2
-guid: e034d1a3f772bb44bbbcd4273f5084e1
-timeCreated: 1516430103
-licenseType: Free
+guid: 591bd551698e54c42bb51c4b2af7ae0e
MonoImporter:
+ externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
diff --git a/Main/System/Task/TaskManager.cs b/Main/System/Task/TaskManager.cs
index 54c522b..50a481f 100644
--- a/Main/System/Task/TaskManager.cs
+++ b/Main/System/Task/TaskManager.cs
@@ -69,9 +69,15 @@
// 浠诲姟鐘舵�� 1-杩涜涓� 2-鍙鍙�
public int GetMainTaskState()
- {
+ {
return mainTask.State;
}
+ //杩橀渶瀹屾垚澶氬皯涓换鍔�
+ public int GetNeedFinishTaskCount(int taskID)
+ {
+ var taskConfig = TaskConfig.Get(taskID);
+ return taskConfig.Index - TaskConfig.Get(mainTask.TaskID).Index + 1;
+ }
}
diff --git a/Main/Utility/UIHelper.cs b/Main/Utility/UIHelper.cs
index 69cd1df..2f6bf80 100644
--- a/Main/Utility/UIHelper.cs
+++ b/Main/Utility/UIHelper.cs
@@ -372,7 +372,7 @@
public static readonly Color s_NavyYellow = new Color32(242, 238, 2, 255); //f2ee02
public static readonly Color s_LightGreen = new Color32(42, 227, 55, 255);//2ae337
public static readonly Color s_LightWhite = new Color32(245, 246, 230, 255); //f5f6e6
- public static readonly Color s_Gray = new Color32(132, 121, 123, 255); //84797b
+ public static readonly Color s_Gray = new Color32(104, 104, 104,255); //bbbbbb
public static readonly Color s_Gold = new Color32(255, 239, 71, 255);//ffef47
public static readonly Color s_EarthYellow = new Color32(248, 152, 59, 255);//f8983b
@@ -715,7 +715,7 @@
case TextColType.LightGreen:
return StringUtility.Contact("<color=#8ddc11>", msg, "</color>");
case TextColType.Gray:
- return StringUtility.Contact("<color=#84797b>", msg, "</color>");
+ return StringUtility.Contact("<color=#bbbbbb>", msg, "</color>");
case TextColType.lightYellow:
return StringUtility.Contact("<color=#fcedb9>", msg, "</color>");
case TextColType.NavyYellow:
--
Gitblit v1.8.0