Core/NetworkPackage/ClientPack/ClientToMapServer/A5_Function/CA555_tagCMGodWeaponPlus.cs
@@ -1,37 +1,24 @@ using UnityEngine; using System.Collections; // A5 55 神兵升级 #tagCMGodWeaponPlus public class CA555_tagCMGodWeaponPlus : GameNetPackBasic { public uint WeaponType; // 神兵类型 public uint ItemID; //消耗的物品ID public CA555_tagCMGodWeaponPlus () { combineCmd = (ushort)0x03FE; _cmd = (ushort)0xA555; } public override void WriteToBytes () { WriteBytes (WeaponType, NetDataType.DWORD); WriteBytes (ItemID, NetDataType.DWORD); } } using UnityEngine; using System.Collections; // A5 55 神兵升级 #tagCMGodWeaponPlus public class CA555_tagCMGodWeaponPlus : GameNetPackBasic { public uint WeaponType; // 神兵类型 public uint ItemID; //消耗的物品ID public byte ItemCount; //消耗个数,默认1 public byte IsAutoBuy; //是否自动购买,默认0 public CA555_tagCMGodWeaponPlus () { combineCmd = (ushort)0x03FE; _cmd = (ushort)0xA555; } public override void WriteToBytes () { WriteBytes (WeaponType, NetDataType.DWORD); WriteBytes (ItemID, NetDataType.DWORD); WriteBytes (ItemCount, NetDataType.BYTE); WriteBytes (IsAutoBuy, NetDataType.BYTE); } } Core/SDK/SDKUtility.cs
@@ -23,6 +23,7 @@ Mr = 2,// 猫耳 Sp = 3,// 思璞 Js = 4,// 极速 Yj = 5,// 易接 } public E_ChannelPlatform ChannelPlatform { get; set; } @@ -355,6 +356,10 @@ { ChannelPlatform = E_ChannelPlatform.Js; } else if (_channelPlatform.Equals("yj")) { ChannelPlatform = E_ChannelPlatform.Yj; } } } break; @@ -590,6 +595,8 @@ public int accountID; public string timeStamp; public string sessionID; public string yjAppId; public string yjSdkId; } public struct FP_CheckIDAuthentication @@ -695,6 +702,14 @@ else if (ChannelPlatform == E_ChannelPlatform.Sp) { m_PaymentTable["RechargeChannel"] = "2"; } else if (ChannelPlatform == E_ChannelPlatform.Js) { m_PaymentTable["RechargeChannel"] = "3"; } else if (ChannelPlatform == E_ChannelPlatform.Yj) { m_PaymentTable["RechargeChannel"] = "5"; } var _stringBuilder = new System.Text.StringBuilder(); @@ -879,6 +894,16 @@ FreePlatformInfo.timeStamp = (string)json["timeStamp"]; } if (_iDict.Contains("yjSdkId")) { FreePlatformInfo.yjSdkId = (string)json["yjSdkId"]; } if (_iDict.Contains("yjAppId")) { FreePlatformInfo.yjAppId = (string)json["yjAppId"]; } FreePlatformInfo.phone = 0; } System/Dungeon/AssistPlayerCell.cs
New file @@ -0,0 +1,59 @@ using UnityEngine; using UnityEngine.UI; using TableConfig; namespace Snxxz.UI { public class AssistPlayerCell : MonoBehaviour { [SerializeField] Text nameText; [SerializeField] Text lvText; [SerializeField] GameObject lvIcon; [SerializeField] Image headIcon; [SerializeField] Image realmIcon; [SerializeField] Button helpBtn; FriendsModel _friendsModel; FriendsModel friendsModel { get { return _friendsModel ?? (_friendsModel = ModelCenter.Instance.GetModel<FriendsModel>()); } } public void SetDisplay(int playerId) { var playerInfo = friendsModel.GetFirendInfo(playerId); if (playerInfo == null) return; nameText.text = playerInfo.PlayerName; headIcon.SetSprite(GeneralDefine.GetOtherJobHeadPortrait(playerInfo.Job, 0)); int realmLv = playerInfo.RealmLV; var realmConfig = Config.Instance.Get<RealmConfig>(playerInfo.RealmLV); realmIcon.SetSprite(realmConfig == null ? "NoRealm" : realmConfig.Img); int nirvanaLv = playerInfo.LV - friendsModel.OpenGreatLV; lvIcon.gameObject.SetActive(nirvanaLv > 0); if (nirvanaLv > 0) { lvText.text = nirvanaLv.ToString(); } else { lvText.text = playerInfo.LV.ToString(); } } public void UpdateAssistState(int assistType) { switch(assistType) { case 0: break; case 1: break; } } } } System/Dungeon/AssistPlayerCell.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: df6489325863f5d45b60e71c8c234e6d timeCreated: 1542617010 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/Dungeon/DungeonAssistModel.cs
New file @@ -0,0 +1,53 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Snxxz.UI { [XLua.LuaCallCSharp] public class DungeonAssistModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk { public string helpInfoLocalSave { get; private set; } public List<string> helpInfolist { get; private set; } public override void Init() { } public void OnBeforePlayerDataInitialize() { } public void OnPlayerLoginOk() { int playerId = (int)PlayerDatas.Instance.baseData.PlayerID; helpInfoLocalSave = StringUtility.Contact("HelpInfoLocalSave", playerId); GetLocalSaveData(); } public override void UnInit() { } private void GetLocalSaveData() { string[] helpInfos = LocalSave.GeStringArray(helpInfoLocalSave); helpInfolist = helpInfos == null ? null : helpInfos.ToList(); } public void SetHelpInfoLocalSave(string info) { helpInfolist = helpInfolist == null ? new List<string>() : helpInfolist; if (helpInfolist.Count >= 20) { helpInfolist.RemoveAt(0); } helpInfolist.Add(info); LocalSave.SetStringArray(helpInfoLocalSave, helpInfolist.ToArray()); } } } System/Dungeon/DungeonAssistModel.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 721bc9700ae71ba4eab410bb7f14f6f3 timeCreated: 1542615038 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/Dungeon/DungeonAssistPlayerWin.cs
New file @@ -0,0 +1,112 @@ using System; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { [XLua.Hotfix] public class DungeonAssistPlayerWin : Window { [SerializeField] Button oneKeyHelpBtn; [SerializeField] Text oneKeyHelpText; [SerializeField] Button refreshBtn; [SerializeField] Text refreshText; [SerializeField] List<AssistPlayerCell> assistPlayers = new List<AssistPlayerCell>(); public const int duration = 10; #region Built-in protected override void BindController() { } protected override void AddListeners() { } protected override void OnPreOpen() { SetDisplay(); } protected override void OnAfterOpen() { } protected override void OnPreClose() { } protected override void OnAfterClose() { } #endregion public void SetDisplay() { UpdateAssistPlayers(); UpdateOneKeyAssist(); UpdateRefreshTimes(); } private void UpdateAssistPlayers() { List<int> playerIds = null; if (playerIds == null) return; for(int i = 0; i < assistPlayers.Count; i++) { var assistPlayer = assistPlayers[i]; if(i < playerIds.Count) { assistPlayer.gameObject.SetActive(true); assistPlayer.SetDisplay(playerIds[i]); } else { assistPlayer.gameObject.SetActive(false); } } } private void UpdateOneKeyAssist() { UpdateTime(duration); TimeDownMgr.Instance.Begin(TimeDownMgr.CoolTimeType.DungeonAssistCoolTime,duration,UpdateTime); } private void UpdateRefreshTimes() { refreshText.text = StringUtility.Contact("刷新\n","(",5,")"); } private void UpdateTime(float time) { if(time > 0) { oneKeyHelpText.text = StringUtility.Contact("一键召唤(",time,")"); } else { oneKeyHelpText.text = "一键召唤"; } } private void ClickOneKeyAssist() { CloseClick(); } private void ClickRefresh() { UpdateAssistPlayers(); UpdateOneKeyAssist(); } } } System/Dungeon/DungeonAssistPlayerWin.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 4a94d7e1c2953de4e8271897605c63a4 timeCreated: 1542615272 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/Dungeon/DungeonAssistWin.cs
@@ -4,6 +4,7 @@ namespace Snxxz.UI { [XLua.Hotfix] public class DungeonAssistWin : Window { [SerializeField] ScrollerController resultCtrl; System/Loading/LoadingWin.cs
@@ -47,8 +47,11 @@ var useDefautBackGround = false; if (!AssetSource.uiFromEditor) { var assetValid = AssetVersionUtility.IsAssetValid("ui/sprite/loadingbg"); useDefautBackGround = !assetValid; var assetVersion = AssetVersionUtility.GetAssetVersion("ui/sprite/loadingbg"); if (assetVersion == null || !assetVersion.localValid) { useDefautBackGround = true; } } if (useDefautBackGround) System/Login/LoginModel.cs
@@ -16,7 +16,8 @@ public SDKUtility.FP_LoginOk sdkLoginResult; public SDKUtility.FP_CheckIDAuthentication sdkIDCheckIDAuthentication; public string localSaveAccountName { public string localSaveAccountName { get { return LocalSave.GetString(USER_ACCOUNT); } set { LocalSave.SetString(USER_ACCOUNT, value); } } @@ -25,19 +26,22 @@ public event Action accountBindOkEvent; bool m_ReconnecBackGround = false; public bool reconnectBackGround { public bool reconnectBackGround { get { return m_ReconnecBackGround; } set { m_ReconnecBackGround = value; } } bool m_OnCreateRole = false; public bool onCreateRole { public bool onCreateRole { get { return m_OnCreateRole; } set { m_OnCreateRole = value; } } bool m_Busy = false; public bool busy { public bool busy { get { return m_Busy; } set { m_Busy = value; } } @@ -297,12 +301,21 @@ send.IDType = 3; send.Extra += ("|" + SDKUtility.Instance.FreePlatformInfo.sessionID); send.ExtraLen = (byte)send.Extra.Length; }else if(SDKUtility.Instance.ChannelPlatform == SDKUtility.E_ChannelPlatform.Js) } else if (SDKUtility.Instance.ChannelPlatform == SDKUtility.E_ChannelPlatform.Js) { send.IDType = 4; send.Extra += ("|" + sdkLoginResult.token); send.ExtraLen = (byte)send.Extra.Length; } else if (SDKUtility.Instance.ChannelPlatform == SDKUtility.E_ChannelPlatform.Yj) { send.IDType = 5; send.Extra += ("|" + SDKUtility.Instance.FreePlatformInfo.yjSdkId + "|" + SDKUtility.Instance.FreePlatformInfo.yjAppId + "|" + SDKUtility.Instance.FreePlatformInfo.accountID); send.ExtraLen = (byte)send.Extra.Length; } send.AccID = sdkLoginResult.account; send.Password = sdkLoginResult.token; send.MAC = DeviceUtility.GetMac(); System/Role/AutoHammerWin.cs
New file @@ -0,0 +1,178 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Monday, November 19, 2018 //-------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using TableConfig; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { public class AutoHammerWin : Window { [SerializeField] Text m_Level; [SerializeField] Button m_Reduce; [SerializeField] Button m_Add; [SerializeField] Text m_TargetLevel; [SerializeField] Text m_Cost; [SerializeField] Button m_Confirm; [SerializeField] Button m_Cancel; [SerializeField] Button m_Close; [SerializeField] Button m_OpenNumkeyboard; [SerializeField] NumKeyBoard m_NumKeyBoard; MagicianModel model { get { return ModelCenter.Instance.GetModel<MagicianModel>(); } } public static event Action<bool> onConfirm; public static int selectGodWeaponType = 1; private int targetLevel = 0; #region Built-in protected override void BindController() { } protected override void AddListeners() { m_Reduce.AddListener(Reduce); m_Add.AddListener(Add); m_Confirm.AddListener(Confirm); m_Cancel.AddListener(CloseClick); m_Close.AddListener(CloseClick); m_OpenNumkeyboard.AddListener(OpenNumkeyboard); m_NumKeyBoard.onValueChange.AddListener(OnValueChange); m_NumKeyBoard.onConfirm.AddListener(OnNumConfirm); } protected override void OnPreOpen() { var godWeaponInfo = model.GetGodWeaponInfo(selectGodWeaponType); if (godWeaponInfo != null) { var configs = GodWeaponConfig.GetConfigs(selectGodWeaponType); var maxLevel = configs[configs.Count - 1].Lv; m_NumKeyBoard.min = (uint)godWeaponInfo.level + 1; m_NumKeyBoard.max = (uint)maxLevel; targetLevel = (int)m_NumKeyBoard.min; } m_NumKeyBoard.gameObject.SetActive(false); DisplayLevel(); DisplayTargetLevel(); } protected override void OnAfterOpen() { } protected override void OnPreClose() { } protected override void OnAfterClose() { } #endregion private void DisplayLevel() { GodWeaponInfo godWeaponInfo = model.GetGodWeaponInfo(selectGodWeaponType); if (godWeaponInfo != null) { var config = GodWeaponConfig.GetConfig(selectGodWeaponType, 1); if (config != null) { m_Level.text = StringUtility.Contact(config.Name, ":", Language.Get("GodWeaponLevel", godWeaponInfo.level)); } } } private void DisplayTargetLevel() { m_TargetLevel.text = targetLevel.ToString(); DisplayCost(); } private void Add() { if (targetLevel + 1 <= m_NumKeyBoard.max) { targetLevel += 1; DisplayTargetLevel(); } } private void Reduce() { if (targetLevel - 1 >= m_NumKeyBoard.min) { targetLevel -= 1; DisplayTargetLevel(); } } private void OpenNumkeyboard() { if (!m_NumKeyBoard.gameObject.activeSelf) { m_NumKeyBoard.gameObject.SetActive(true); } } private void DisplayCost() { } private void Confirm() { if (targetLevel >= m_NumKeyBoard.max) { targetLevel = (int)m_NumKeyBoard.max; } else if (targetLevel <= m_NumKeyBoard.min) { targetLevel = (int)m_NumKeyBoard.min; } model.autoHammerLevel = targetLevel; if (onConfirm != null) { onConfirm(true); } } private void OnNumConfirm(bool isOk) { m_NumKeyBoard.gameObject.SetActive(false); } private void OnValueChange() { var level = targetLevel; int.TryParse(m_NumKeyBoard.Value, out level); if (level >= m_NumKeyBoard.max) { level = (int)m_NumKeyBoard.max; } else if (level <= m_NumKeyBoard.min) { level = (int)m_NumKeyBoard.min; } targetLevel = level; DisplayTargetLevel(); } } } System/Role/AutoHammerWin.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 2a1a00bd8374c7f45bcbf4d4564293f0 timeCreated: 1542593303 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/Role/GodWeaponPreviewWin.cs
New file @@ -0,0 +1,98 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Monday, November 19, 2018 //-------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using TableConfig; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { public class GodWeaponPreviewWin : Window { [SerializeField] Text m_Stage; [SerializeField] Text m_RequireLevel; [SerializeField] Button[] m_SelectStages; [SerializeField] Image m_Select; [SerializeField] RawImage m_RawModel; [SerializeField] Button m_Close; int selectStage = 1; public static int selectGodWeaponType = 1; MagicianModel model { get { return ModelCenter.Instance.GetModel<MagicianModel>(); } } #region Built-in protected override void BindController() { } protected override void AddListeners() { m_Close.onClick.AddListener(CloseClick); for (int i = 0; i < m_SelectStages.Length; i++) { var index = i + 1; m_SelectStages[i].AddListener(() => { OnSelectStage(index); }); } } protected override void OnPreOpen() { OnSelectStage(1); } protected override void OnAfterOpen() { } protected override void OnPreClose() { } protected override void OnAfterClose() { } #endregion private void OnSelectStage(int index) { m_Select.transform.localPosition = m_SelectStages[index - 1].transform.localPosition; selectStage = index; DisplayModel(); DisplayStage(); DisplayRequireLevel(); } private void DisplayStage() { var config = GodWeaponConfig.GetConfig(selectGodWeaponType, 1); m_Stage.text = StringUtility.Contact(config.Name, Language.Get("GodWeaponStage", selectStage)); } private void DisplayRequireLevel() { } private void DisplayModel() { } } } System/Role/GodWeaponPreviewWin.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 6971b7c6ed2acd441aa0ff78f1998dcd timeCreated: 1542616197 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/Role/MagicianModel.cs
@@ -70,6 +70,10 @@ public Dictionary<int, string> godWeaponIcons { get; private set; } public Dictionary<int, Dictionary<int, int>> godWeaponSkillDict = new Dictionary<int, Dictionary<int, int>>(); Dictionary<int, List<GodWeaponCondition>> godWeaponConditions = new Dictionary<int, List<GodWeaponCondition>>(); public List<int> godWeaponSorts = new List<int>(); int[] autoHammerExpArea { get; set; } int[] autoHammerCount { get; set; } int m_SelectType = 0; public int selectType @@ -90,6 +94,8 @@ public int selectItemIndex = 0; public int gotoType = 0; public int autoHammerLevel { get; set; } void ParseConfig() { godWeaponTypes = GodWeaponConfig.GetGodWeaponType(); @@ -163,6 +169,16 @@ level = condition[1], }); } } var sortConfig = Config.Instance.Get<FuncConfigConfig>("GodWeaponSort"); godWeaponSorts.AddRange(ConfigParse.GetMultipleStr<int>(sortConfig.Numerical1)); var autoHammerConfig = Config.Instance.Get<FuncConfigConfig>("GodWeaponAutoHammer"); if (autoHammerConfig != null) { autoHammerExpArea = ConfigParse.GetMultipleStr<int>(autoHammerConfig.Numerical1); autoHammerCount = ConfigParse.GetMultipleStr<int>(autoHammerConfig.Numerical2); } } @@ -252,10 +268,12 @@ } return; } CA555_tagCMGodWeaponPlus _pak = new CA555_tagCMGodWeaponPlus(); _pak.WeaponType = (uint)type; _pak.ItemID = (uint)itemId; GameNetSystem.Instance.SendInfo(_pak); CA555_tagCMGodWeaponPlus pak = new CA555_tagCMGodWeaponPlus(); pak.WeaponType = (uint)type; pak.ItemID = (uint)itemId; pak.ItemCount = 1; pak.IsAutoBuy = 0; GameNetSystem.Instance.SendInfo(pak); } public event Action godWeaponUpdate; @@ -289,6 +307,10 @@ if (WindowCenter.Instance.IsOpen<MagicianWin>() && !NewBieCenter.Instance.inGuiding) { if (WindowCenter.Instance.IsOpen<GodWeaponPreviewWin>()) { WindowCenter.Instance.CloseImmediately<GodWeaponPreviewWin>(); } ActivateShow.GodWeaponActivate(_type, _nowLv, _beforeLv); } } @@ -375,6 +397,36 @@ return true; } public int GetAutoHammerCount(int type) { ulong totalExp = 0; var godWeaponInfo = GetGodWeaponInfo(type); if (godWeaponInfo == null || autoHammerExpArea == null || autoHammerCount == null) { return 1; } totalExp += godWeaponInfo.exp; for (int i = 1; i < godWeaponInfo.level; i++) { var config = GodWeaponConfig.GetConfig(type, i); totalExp += (ulong)config.NeedExp; } var index = 0; for (int i = 0; i < autoHammerExpArea.Length; i++) { if (totalExp < (ulong)autoHammerExpArea[i]) { index = i; break; } } if (index < autoHammerCount.Length) { return autoHammerCount[index]; } return autoHammerCount[autoHammerCount.Length - 1]; } public bool ContainsCondition(int type) { return godWeaponConditions.ContainsKey(type); System/Role/MagicianWin.cs
@@ -15,11 +15,15 @@ [SerializeField] ScrollerController m_GodWeaponController; [SerializeField] LongPressButton m_Hammer; [SerializeField] Text m_HammerLabel; [SerializeField] Button m_AutoHammer; [SerializeField] Text m_AutoHammerLabel; [SerializeField] Button m_Preview; [SerializeField] Text m_PropertyTitle; [SerializeField] Text m_CostItemTitle; [SerializeField] RectTransform m_ContainerUnlock; [SerializeField] RectTransform m_ContainerSlider; [SerializeField] IntensifySmoothSlider m_ExpSlider; [SerializeField] Text m_Exp; [SerializeField] PropertyBehaviour[] m_Propertys; @@ -50,7 +54,40 @@ } int selectItemCount = 0; bool moneyHammer = false; bool lockGodWeaponUpdate = false; bool lockItemUpdate = false; AutoHammerState m_LastAutoHammerState = AutoHammerState.None; AutoHammerState m_AutoHammerState = AutoHammerState.None; AutoHammerState autoHammerState { get { return m_AutoHammerState; } set { m_LastAutoHammerState = m_AutoHammerState; m_AutoHammerState = value; switch (m_AutoHammerState) { case AutoHammerState.None: OnExitAutoHammer(); break; case AutoHammerState.Hammer: OnHammer(); break; case AutoHammerState.WaitAnimation: break; case AutoHammerState.WaitServer: OnWaitServer(); break; } DisplayAutoHammerLabel(); } } FunctionUnlockFlyObjectTarget flyObjectTarget; float waitServerTimer = 0f; const float WaitServerTime = 5.0f; static Dictionary<int, int> currentPropertyDict = new Dictionary<int, int>(); static List<int> displayPropertys = new List<int>(); @@ -66,6 +103,8 @@ m_GodWeaponController.OnRefreshCell += OnRefreshCell; m_Hammer.onClick.AddListener(Hammer); m_Hammer.onPress.AddListener(PressHammer); m_Preview.onClick.AddListener(Preview); m_AutoHammer.onClick.AddListener(AutoHammer); for (int i = 0; i < m_Items.Length; i++) { var index = i; @@ -78,6 +117,12 @@ protected override void OnPreOpen() { autoHammerState = AutoHammerState.None; m_LastAutoHammerState = AutoHammerState.None; moneyHammer = false; lockGodWeaponUpdate = false; lockItemUpdate = false; DisplayGodWeaponTypes(); if (!HandleAchievement()) @@ -102,9 +147,11 @@ model.onSelectUpdate += OnSelectUpdate; model.godWeaponUpdate += GodWeaponUpdate; packModel.RefreshItemCountAct += RefreshItemCountAct; WindowCenter.Instance.windowBeforeOpenEvent += WindowBeforeOpenEvent; WindowCenter.Instance.windowBeforeCloseEvent += WindowBeforeCloseEvent; ActivateShow.prepareFlySkillEvent += PrepareFlySkillEvent; ActivateShow.complelteFlySkillEvent += ComplelteFlySkillEvent; AutoHammerWin.onConfirm += OnAutoHammerConfirm; } protected override void OnAfterOpen() @@ -119,14 +166,34 @@ protected override void OnPreClose() { autoHammerState = AutoHammerState.None; SysNotifyMgr.Instance.sysNotifyEvent -= SysNotifyEvent; model.onSelectUpdate -= OnSelectUpdate; model.godWeaponUpdate -= GodWeaponUpdate; packModel.RefreshItemCountAct -= RefreshItemCountAct; WindowCenter.Instance.windowBeforeOpenEvent -= WindowBeforeOpenEvent; WindowCenter.Instance.windowBeforeCloseEvent -= WindowBeforeCloseEvent; ActivateShow.prepareFlySkillEvent -= PrepareFlySkillEvent; ActivateShow.complelteFlySkillEvent -= ComplelteFlySkillEvent; AutoHammerWin.onConfirm -= OnAutoHammerConfirm; UI3DTreasureExhibition.Instance.StopShow(); } protected override void LateUpdate() { base.LateUpdate(); switch (autoHammerState) { case AutoHammerState.Hammer: break; case AutoHammerState.WaitServer: waitServerTimer += Time.deltaTime; if (waitServerTimer >= WaitServerTime) { autoHammerState = AutoHammerState.Hammer; } break; } } #endregion @@ -186,6 +253,25 @@ if (window is RealmPropertyUpWin) { DisplayGodWeaponModel(); if (autoHammerState == AutoHammerState.WaitAnimation) { autoHammerState = AutoHammerState.Hammer; } } else if (window is GodWeaponPreviewWin) { DisplayGodWeaponModel(); } } private void WindowBeforeOpenEvent(Window window) { if (window is RealmPropertyUpWin) { if (autoHammerState != AutoHammerState.None) { autoHammerState = AutoHammerState.WaitAnimation; } } } @@ -208,6 +294,15 @@ { OnSelectItem(GetItemIndex(model.selectType, model.selectItemIndex)); } if (model.IsGodWeaponHammerItem(model.selectType, itemId)) { lockItemUpdate = false; if (!moneyHammer && autoHammerState == AutoHammerState.WaitServer && !lockItemUpdate && !lockGodWeaponUpdate) { autoHammerState = AutoHammerState.Hammer; } } } } @@ -220,12 +315,35 @@ DisplaySelectItem(); DisplayGodWeaponModel(); m_GodWeaponController.m_Scorller.RefreshActiveCellViews(); if (autoHammerState != AutoHammerState.None) { autoHammerState = AutoHammerState.None; } } private void GodWeaponUpdate() { m_GodWeaponController.m_Scorller.RefreshActiveCellViews(); DisplayGodWeaponInfo(false); lockGodWeaponUpdate = false; if (!lockGodWeaponUpdate) { if (moneyHammer) { if (autoHammerState == AutoHammerState.WaitServer) { autoHammerState = AutoHammerState.Hammer; } } else { if (!lockItemUpdate && autoHammerState == AutoHammerState.WaitServer) { autoHammerState = AutoHammerState.Hammer; } } } } private void DisplayGodWeaponInfo(bool immediatly) @@ -233,6 +351,9 @@ bool active = model.IsGodWeaponUnlock(model.selectType); m_ContainerLock.gameObject.SetActive(!active); m_ContainerUnlock.gameObject.SetActive(active); m_ContainerSlider.gameObject.SetActive(active); m_AutoHammer.gameObject.SetActive(active); m_Hammer.gameObject.SetActive(active || model.SatisfyUnlockCondition(model.selectType)); if (!active) { m_CostItemTitle.text = Language.Get("L1049"); @@ -243,6 +364,7 @@ } else { m_ContainerProgress.gameObject.SetActive(false); m_CostItemTitle.text = Language.Get("L1052"); m_PropertyTitle.text = Language.Get("L1051"); m_HammerLabel.text = Language.Get("L1131"); @@ -509,11 +631,14 @@ { if (m_GodWeaponController.GetNumberOfCells(m_GodWeaponController.m_Scorller) == 0) { var list = model.godWeaponTypes; var list = model.godWeaponSorts; m_GodWeaponController.Refresh(); for (int i = 0; i < list.Count; i++) { m_GodWeaponController.AddCell(ScrollerDataType.Header, list[i], OnGodWeaponSelect); if (model.godWeaponTypes.Contains(list[i])) { m_GodWeaponController.AddCell(ScrollerDataType.Header, list[i], OnGodWeaponSelect); } } m_GodWeaponController.Restart(); } @@ -562,6 +687,10 @@ private void PressHammer() { if (autoHammerState != AutoHammerState.None) { return; } if (selectItemCount <= 0) { OnSelectItem(GetItemIndex(model.selectType)); @@ -586,6 +715,10 @@ private void Hammer() { if (autoHammerState != AutoHammerState.None) { return; } var godWeaponInfo = model.GetGodWeaponInfo(model.selectType); bool requireSwitchItem = false; if (godWeaponInfo != null) @@ -606,6 +739,128 @@ { OnSelectItem(GetItemIndex(model.selectType, model.selectItemIndex)); } } private void OnAutoHammerConfirm(bool isOk) { if (isOk && autoHammerState == AutoHammerState.None) { moneyHammer = true; autoHammerState = AutoHammerState.Hammer; } } private void AutoHammer() { if (autoHammerState != AutoHammerState.None) { autoHammerState = AutoHammerState.None; } else { var index = 0; if (model.IsGodWeaponMaxLevel(model.selectType)) { return; } if (ExistAnyHammerItem(model.selectType, out index)) { autoHammerState = AutoHammerState.Hammer; moneyHammer = false; } else { AutoHammerWin.selectGodWeaponType = model.selectType; WindowCenter.Instance.Open<AutoHammerWin>(); } } } private void OnHammer() { if (model.IsGodWeaponMaxLevel(model.selectType)) { autoHammerState = AutoHammerState.None; return; } var index = 0; if (!moneyHammer) { if (!ExistAnyHammerItem(model.selectType, out index)) { autoHammerState = AutoHammerState.None; return; } var items = model.GetLevelUpItemByType(model.selectType); CA555_tagCMGodWeaponPlus pak = new CA555_tagCMGodWeaponPlus(); pak.ItemID = (uint)items[index]; pak.WeaponType = (uint)model.selectType; pak.IsAutoBuy = 1; pak.ItemCount = 1; GameNetSystem.Instance.SendInfo(pak); } else { var godWeaponInfo = model.GetGodWeaponInfo(model.selectType); if (godWeaponInfo != null && godWeaponInfo.level >= model.autoHammerLevel) { autoHammerState = AutoHammerState.None; return; } } lockGodWeaponUpdate = true; lockItemUpdate = true; autoHammerState = AutoHammerState.WaitServer; } private void DisplayAutoHammerLabel() { switch (autoHammerState) { case AutoHammerState.None: m_AutoHammerLabel.text = Language.Get("AutoHammerBtnTxt"); break; case AutoHammerState.Hammer: case AutoHammerState.WaitAnimation: case AutoHammerState.WaitServer: m_AutoHammerLabel.text = Language.Get("CancelAutoHammerBtnTxt"); break; } } private void OnExitAutoHammer() { if (m_LastAutoHammerState != AutoHammerState.None) { DisplayExp(true); } } private void OnWaitServer() { waitServerTimer = 0f; } private void Preview() { GodWeaponPreviewWin.selectGodWeaponType = model.selectType; WindowCenter.Instance.Open<GodWeaponPreviewWin>(); } bool ExistAnyHammerItem(int type, out int index) { var items = model.GetLevelUpItemByType(type); index = 0; for (int i = items.Length - 1; i >= 0; i--) { var count = packModel.GetItemCountByID(PackType.rptItem, items[i]); if (count > 0) { index = i; return true; } } return false; } bool HandleAchievement() @@ -631,6 +886,14 @@ } return false; } enum AutoHammerState { None, Hammer, WaitAnimation, WaitServer, } } } System/WindowBase/ModelCenter.cs
@@ -208,6 +208,7 @@ RegisterModel<AccumulateRechargeModel>(); RegisterModel<FBHelpPointExchageModel>(); RegisterModel<IceCrystalVeinModel>(); RegisterModel<DungeonAssistModel>(); inited = true; } UI/Common/TimeDownMgr.cs
@@ -5,7 +5,7 @@ [XLua.LuaCallCSharp] public class TimeDownMgr : SingletonMonobehaviour<TimeDownMgr> { public enum CoolTimeType { @@ -27,6 +27,7 @@ HappyFreeRuneXB = 15, //符印寻宝免费时间倒计时 HappyXBWarehouse = 16, //寻宝仓库整理倒计时 FlashRushToBuyAppointment = 17, //限时抢购预约倒计时 DungeonAssistCoolTime = 18, //副本助战一键召唤倒计时 } public void Begin(CoolTimeType type, float duration,Action<float> func,float tick=1.0f)