197 子 【内政】淘金系统 / 【内政】淘金系统-客户端
New file |
| | |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using System; |
| | | |
| | | /// <summary> |
| | | /// 带有+-按钮控制数量显示和回调 |
| | | /// </summary> |
| | | public class CountControler : MonoBehaviour |
| | | { |
| | | [SerializeField] Text countText; |
| | | [SerializeField] LongPressButton addBtn; |
| | | [SerializeField] LongPressButton decBtn; |
| | | |
| | | int count; //当前数量 |
| | | int maxCount; //最大数量 |
| | | |
| | | Action<int> OnChangeEvent; |
| | | Func<int, bool> CanAddEvent; |
| | | Func<int, bool> CanDecEvent; |
| | | void Start() |
| | | { |
| | | addBtn.AddListener(() => |
| | | { |
| | | if (CanAddEvent == null || !CanAddEvent(count)) |
| | | { |
| | | return; |
| | | } |
| | | count++; |
| | | Refresh(); |
| | | }); |
| | | addBtn.onPress.AddListener(() => |
| | | { |
| | | if (CanAddEvent == null || !CanAddEvent(count)) |
| | | { |
| | | return; |
| | | } |
| | | count++; |
| | | Refresh(); |
| | | }); |
| | | decBtn.AddListener(() => |
| | | { |
| | | if (CanDecEvent == null || !CanDecEvent(count)) |
| | | { |
| | | return; |
| | | } |
| | | count--; |
| | | Refresh(); |
| | | }); |
| | | decBtn.onPress.AddListener(() => |
| | | { |
| | | if (CanDecEvent == null || !CanDecEvent(count)) |
| | | { |
| | | return; |
| | | } |
| | | count--; |
| | | Refresh(); |
| | | }); |
| | | |
| | | } |
| | | |
| | | public void Init(Action<int> _OnChangeEvent, int _maxCount, int _count = 1, Func<int, bool> _CanAddEvent = null, Func<int, bool> _CanDecEvent = null) |
| | | { |
| | | count = _count; |
| | | maxCount = _maxCount; |
| | | OnChangeEvent = _OnChangeEvent; |
| | | CanAddEvent = _CanAddEvent; |
| | | CanDecEvent = _CanDecEvent; |
| | | |
| | | Refresh(); |
| | | |
| | | } |
| | | |
| | | void Refresh() |
| | | { |
| | | |
| | | if (count >= maxCount) |
| | | { |
| | | count = maxCount; |
| | | addBtn.interactable = false; |
| | | addBtn.SetColorful(null, false); |
| | | } |
| | | else |
| | | { |
| | | addBtn.interactable = true; |
| | | addBtn.SetColorful(null, true); |
| | | } |
| | | |
| | | if (count <= 0) |
| | | { |
| | | count = 0; |
| | | decBtn.interactable = false; |
| | | decBtn.SetColorful(null, false); |
| | | } |
| | | else |
| | | { |
| | | decBtn.interactable = true; |
| | | decBtn.SetColorful(null, true); |
| | | } |
| | | |
| | | countText.text = count + "/" + maxCount; |
| | | OnChangeEvent?.Invoke(count); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: f983682626e85224c9d1ec567cdfadf1 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | |
| | | //关联按钮,其中一个亮起,其他按下,文字颜色对应变更 |
| | | //数据更新通过SelectBtn更新 或者 GroupButtonExManager.SelectButton |
| | | //使用步骤 1.序列化GroupButtonEx类型的按钮,2:初始需设置SelectBtn()选中哪个按钮,其他和按钮使用方法一致 |
| | | public class GroupButtonEx : ButtonEx |
| | | { |
| | | [SerializeField] GroupButtonExManager m_Manager; // 按钮组管理器引用 |
| | |
| | | typeof(DirtyWordConfig),
|
| | | typeof(FaceConfig),
|
| | | typeof(FightPowerRatioConfig),
|
| | | typeof(GoldRushCampConfig),
|
| | | typeof(GoldRushItemConfig),
|
| | | typeof(GoldRushWorkerConfig),
|
| | | typeof(HeroLineupHaloConfig),
|
| | | typeof(HeroQualityLVConfig),
|
| | | typeof(InvestConfig),
|
| | |
| | | ClearConfigDictionary<FaceConfig>();
|
| | | // 清空 FightPowerRatioConfig 字典
|
| | | ClearConfigDictionary<FightPowerRatioConfig>();
|
| | | // 清空 GoldRushCampConfig 字典
|
| | | ClearConfigDictionary<GoldRushCampConfig>();
|
| | | // 清空 GoldRushItemConfig 字典
|
| | | ClearConfigDictionary<GoldRushItemConfig>();
|
| | | // 清空 GoldRushWorkerConfig 字典
|
| | | ClearConfigDictionary<GoldRushWorkerConfig>();
|
| | | // 清空 HeroLineupHaloConfig 字典
|
| | | ClearConfigDictionary<HeroLineupHaloConfig>();
|
| | | // 清空 HeroQualityLVConfig 字典
|
| | |
| | | return string.Empty;
|
| | | }
|
| | |
|
| | | //一维数组:来源格式如 1|2|3|4
|
| | | public static T[] GetMultipleStr<T>(string msg) where T : struct
|
| | | {
|
| | | string[] segs = GetMultipleStr(msg);
|
New file |
| | |
| | | //--------------------------------------------------------
|
| | | // [Author]: YYL
|
| | | // [ Date ]: 2025年9月22日
|
| | | //--------------------------------------------------------
|
| | |
|
| | | using System.Collections.Generic;
|
| | | using System;
|
| | | using UnityEngine;
|
| | | using LitJson;
|
| | |
|
| | | public partial class GoldRushCampConfig : ConfigBase<int, GoldRushCampConfig>
|
| | | {
|
| | | static GoldRushCampConfig()
|
| | | {
|
| | | // 访问过静态构造函数
|
| | | visit = true; |
| | | }
|
| | |
|
| | | public int CampID;
|
| | | public int PanningUnlock;
|
| | | public int[] MoneyUnlock;
|
| | |
|
| | | public override int LoadKey(string _key)
|
| | | {
|
| | | int key = GetKey(_key);
|
| | | return key;
|
| | | }
|
| | |
|
| | | public override void LoadConfig(string input)
|
| | | {
|
| | | try {
|
| | | string[] tables = input.Split('\t');
|
| | | int.TryParse(tables[0],out CampID); |
| | |
|
| | | int.TryParse(tables[1],out PanningUnlock); |
| | |
|
| | | if (tables[2].Contains("[")) |
| | | { |
| | | MoneyUnlock = JsonMapper.ToObject<int[]>(tables[2]); |
| | | } |
| | | else |
| | | { |
| | | string[] MoneyUnlockStringArray = tables[2].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); |
| | | MoneyUnlock = new int[MoneyUnlockStringArray.Length]; |
| | | for (int i=0;i<MoneyUnlockStringArray.Length;i++) |
| | | { |
| | | int.TryParse(MoneyUnlockStringArray[i],out MoneyUnlock[i]); |
| | | } |
| | | }
|
| | | }
|
| | | catch (Exception exception)
|
| | | {
|
| | | Debug.LogError(exception);
|
| | | }
|
| | | }
|
| | | }
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: bdc47c65f607d5f41aad27a9507f9e82 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | //--------------------------------------------------------
|
| | | // [Author]: YYL
|
| | | // [ Date ]: 2025年9月22日
|
| | | //--------------------------------------------------------
|
| | |
|
| | | using System.Collections.Generic;
|
| | | using System;
|
| | | using UnityEngine;
|
| | | using LitJson;
|
| | |
|
| | | public partial class GoldRushItemConfig : ConfigBase<int, GoldRushItemConfig>
|
| | | {
|
| | | static GoldRushItemConfig()
|
| | | {
|
| | | // 访问过静态构造函数
|
| | | visit = true; |
| | | }
|
| | |
|
| | | public int GoldID;
|
| | | public int ItemID;
|
| | | public int ItemLV;
|
| | | public int ItemCount;
|
| | | public int WorkerMax;
|
| | | public int NeedSeconds;
|
| | |
|
| | | public override int LoadKey(string _key)
|
| | | {
|
| | | int key = GetKey(_key);
|
| | | return key;
|
| | | }
|
| | |
|
| | | public override void LoadConfig(string input)
|
| | | {
|
| | | try {
|
| | | string[] tables = input.Split('\t');
|
| | | int.TryParse(tables[0],out GoldID); |
| | |
|
| | | int.TryParse(tables[1],out ItemID); |
| | |
|
| | | int.TryParse(tables[2],out ItemLV); |
| | |
|
| | | int.TryParse(tables[3],out ItemCount); |
| | |
|
| | | int.TryParse(tables[4],out WorkerMax); |
| | |
|
| | | int.TryParse(tables[5],out NeedSeconds); |
| | | }
|
| | | catch (Exception exception)
|
| | | {
|
| | | Debug.LogError(exception);
|
| | | }
|
| | | }
|
| | | }
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 72f509bb5c2d2eb4a8e9325e52dc2ea7 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | //--------------------------------------------------------
|
| | | // [Author]: YYL
|
| | | // [ Date ]: Monday, September 22, 2025
|
| | | //--------------------------------------------------------
|
| | |
|
| | | using System.Collections.Generic;
|
| | | using System;
|
| | | using UnityEngine;
|
| | | using LitJson;
|
| | |
|
| | | public partial class GoldRushWorkerConfig : ConfigBase<int, GoldRushWorkerConfig>
|
| | | {
|
| | | static GoldRushWorkerConfig()
|
| | | {
|
| | | // 访问过静态构造函数
|
| | | visit = true; |
| | | }
|
| | |
|
| | | public int WorkerID;
|
| | | public string Name;
|
| | | public int PlayerLVUnlock;
|
| | | public int[] MoneyUnlock;
|
| | | public int SkinID;
|
| | |
|
| | | public override int LoadKey(string _key)
|
| | | {
|
| | | int key = GetKey(_key);
|
| | | return key;
|
| | | }
|
| | |
|
| | | public override void LoadConfig(string input)
|
| | | {
|
| | | try {
|
| | | string[] tables = input.Split('\t');
|
| | | int.TryParse(tables[0],out WorkerID); |
| | |
|
| | | Name = tables[1];
|
| | |
|
| | | int.TryParse(tables[2],out PlayerLVUnlock); |
| | |
|
| | | if (tables[3].Contains("[")) |
| | | { |
| | | MoneyUnlock = JsonMapper.ToObject<int[]>(tables[3]); |
| | | } |
| | | else |
| | | { |
| | | string[] MoneyUnlockStringArray = tables[3].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); |
| | | MoneyUnlock = new int[MoneyUnlockStringArray.Length]; |
| | | for (int i=0;i<MoneyUnlockStringArray.Length;i++) |
| | | { |
| | | int.TryParse(MoneyUnlockStringArray[i],out MoneyUnlock[i]); |
| | | } |
| | | }
|
| | |
|
| | | int.TryParse(tables[4],out SkinID); |
| | | }
|
| | | catch (Exception exception)
|
| | | {
|
| | | Debug.LogError(exception);
|
| | | }
|
| | | }
|
| | | }
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 8e91e6e26f681b74aacc2e21d5624b0e |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 0e42d9937d892ef4380d5873498135e5 |
| | | folderAsset: yes |
| | | DefaultImporter: |
| | | externalObjects: {} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // B0 36 淘金操作 #tagCSGoldRushOP
|
| | |
|
| | | public class CB036_tagCSGoldRushOP : GameNetPackBasic {
|
| | | public byte OPType; // 0-接受淘金;1-刷新淘金;2-开始淘金或调整监工数;3-取消淘金
|
| | | public byte CampID; // 营地ID
|
| | | public byte WorkerCnt; // 派遣监工数,仅类型2有效
|
| | |
|
| | | public CB036_tagCSGoldRushOP () {
|
| | | combineCmd = (ushort)0x03FE;
|
| | | _cmd = (ushort)0xB036;
|
| | | }
|
| | |
|
| | | public override void WriteToBytes () {
|
| | | WriteBytes (OPType, NetDataType.BYTE);
|
| | | WriteBytes (CampID, NetDataType.BYTE);
|
| | | WriteBytes (WorkerCnt, NetDataType.BYTE);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 296895007a9ba9d4a87849c7cd6bb975 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // B0 37 淘金解锁 #tagCSGoldRushUnlock
|
| | |
|
| | | public class CB037_tagCSGoldRushUnlock : GameNetPackBasic {
|
| | | public byte UnlockType; // 0-营地;1-监工
|
| | | public byte UnlockID; // 解锁类型对应的ID
|
| | |
|
| | | public CB037_tagCSGoldRushUnlock () {
|
| | | combineCmd = (ushort)0x03FE;
|
| | | _cmd = (ushort)0xB037;
|
| | | }
|
| | |
|
| | | public override void WriteToBytes () {
|
| | | WriteBytes (UnlockType, NetDataType.BYTE);
|
| | | WriteBytes (UnlockID, NetDataType.BYTE);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: fb441d2b380f8e74ab36cbd2a00771f3 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // B0 38 淘金仓库领奖 #tagCSGoldRushWarehouseAward
|
| | |
|
| | | public class CB038_tagCSGoldRushWarehouseAward : GameNetPackBasic {
|
| | | public byte AwardIndex; // 领奖位置索引,从0开始
|
| | | public byte IsAll; // 是否领取所有
|
| | |
|
| | | public CB038_tagCSGoldRushWarehouseAward () {
|
| | | combineCmd = (ushort)0x03FE;
|
| | | _cmd = (ushort)0xB038;
|
| | | }
|
| | |
|
| | | public override void WriteToBytes () {
|
| | | WriteBytes (AwardIndex, NetDataType.BYTE);
|
| | | WriteBytes (IsAll, NetDataType.BYTE);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 7fb3ef2247d90a449a9071ad0231ab19 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // B0 39 自动淘金免费使用 #tagCSGoldRushAutoFreeUse
|
| | |
|
| | | public class CB039_tagCSGoldRushAutoFreeUse : GameNetPackBasic {
|
| | |
|
| | | public CB039_tagCSGoldRushAutoFreeUse () {
|
| | | combineCmd = (ushort)0x03FE;
|
| | | _cmd = (ushort)0xB039;
|
| | | }
|
| | |
|
| | | public override void WriteToBytes () {
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 00d1fb82f8071ab468b880ac99112f64 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 26d5b9bf2617a8c4eab5a7b44fff8a6b |
| | | folderAsset: yes |
| | | DefaultImporter: |
| | | externalObjects: {} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | // B0 36 淘金相关信息 #tagSCGoldRushInfo
|
| | |
|
| | | public class DTCB036_tagSCGoldRushInfo : DtcBasic {
|
| | | public override void Done(GameNetPackBasic vNetPack)
|
| | | {
|
| | | base.Done(vNetPack);
|
| | | HB036_tagSCGoldRushInfo vNetData = vNetPack as HB036_tagSCGoldRushInfo;
|
| | | GoldRushManager.Instance.UpdateGoldRushInfo(vNetData);
|
| | | }
|
| | | }
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: b7d45ed4800426541a0890be19402c89 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | // B0 37 淘金营地信息 #tagSCGoldRushCampInfo
|
| | |
|
| | | public class DTCB037_tagSCGoldRushCampInfo : DtcBasic {
|
| | | public override void Done(GameNetPackBasic vNetPack)
|
| | | {
|
| | | base.Done(vNetPack);
|
| | | HB037_tagSCGoldRushCampInfo vNetData = vNetPack as HB037_tagSCGoldRushCampInfo;
|
| | | GoldRushManager.Instance.UpdateGoldRushCampInfo(vNetData);
|
| | | }
|
| | | }
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: ac641383195ddde4dba05a8dbe123aac |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | Register(typeof(HA720_tagMCCreateRoleAwardState), typeof(DTCA720_tagMCCreateRoleAwardState)); |
| | | Register(typeof(HB405_tagMCAddExp), typeof(DTCB405_tagMCAddExp)); |
| | | Register(typeof(HB123_tagSCDropBootyInfo), typeof(DTCB123_tagSCDropBootyInfo)); |
| | | Register(typeof(HB036_tagSCGoldRushInfo), typeof(DTCB036_tagSCGoldRushInfo)); |
| | | Register(typeof(HB037_tagSCGoldRushCampInfo), typeof(DTCB037_tagSCGoldRushCampInfo)); |
| | | } |
| | | |
| | | //主工程注册封包 |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: f805cb72dad807b4ab0ec9f876f78075 |
| | | folderAsset: yes |
| | | DefaultImporter: |
| | | externalObjects: {} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // B0 36 淘金相关信息 #tagSCGoldRushInfo
|
| | |
|
| | | public class HB036_tagSCGoldRushInfo : GameNetPackBasic {
|
| | | public uint CampState; // 已解锁营地状态,按营地ID二进制位运算判断是否已解锁
|
| | | public uint WorkerState; // 已雇佣工人状态,按工人ID二进制位运算判断是否已解锁
|
| | | public uint PanningCnt; // 累计淘金次数
|
| | | public uint LastRecoverTime; // 上次免费恢复淘金令时间戳,为0时可不用倒计时
|
| | | public uint HousekeeperEndTime; // 自动管家到期时间戳,有值同时也代表免费试用已使用
|
| | | public byte WarehouseCnt; // 淘金仓库物品数
|
| | | public byte[] WarehouseIDList; // 淘金仓库已完成淘金ID列表 [索引0淘金ID, ...],淘金ID为0代表该索引位置为空
|
| | |
|
| | | public HB036_tagSCGoldRushInfo () {
|
| | | _cmd = (ushort)0xB036;
|
| | | }
|
| | |
|
| | | public override void ReadFromBytes (byte[] vBytes) {
|
| | | TransBytes (out CampState, vBytes, NetDataType.DWORD);
|
| | | TransBytes (out WorkerState, vBytes, NetDataType.DWORD);
|
| | | TransBytes (out PanningCnt, vBytes, NetDataType.DWORD);
|
| | | TransBytes (out LastRecoverTime, vBytes, NetDataType.DWORD);
|
| | | TransBytes (out HousekeeperEndTime, vBytes, NetDataType.DWORD);
|
| | | TransBytes (out WarehouseCnt, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out WarehouseIDList, vBytes, NetDataType.BYTE, WarehouseCnt);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: fa2673764a1c61c4ba9c159c1c55b3dd |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // B0 37 淘金营地信息 #tagSCGoldRushCampInfo
|
| | |
|
| | | public class HB037_tagSCGoldRushCampInfo : GameNetPackBasic {
|
| | | public byte CampCnt;
|
| | | public tagSCGoldRushCamp[] CampList; // 营地列表
|
| | |
|
| | | public HB037_tagSCGoldRushCampInfo () {
|
| | | _cmd = (ushort)0xB037;
|
| | | }
|
| | |
|
| | | public override void ReadFromBytes (byte[] vBytes) {
|
| | | TransBytes (out CampCnt, vBytes, NetDataType.BYTE);
|
| | | CampList = new tagSCGoldRushCamp[CampCnt];
|
| | | for (int i = 0; i < CampCnt; i ++) {
|
| | | CampList[i] = new tagSCGoldRushCamp();
|
| | | TransBytes (out CampList[i].CampID, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out CampList[i].GoldID, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out CampList[i].RefreshCnt, vBytes, NetDataType.WORD);
|
| | | TransBytes (out CampList[i].EndTime, vBytes, NetDataType.DWORD);
|
| | | TransBytes (out CampList[i].WorkerCnt, vBytes, NetDataType.BYTE);
|
| | | }
|
| | | }
|
| | |
|
| | | public class tagSCGoldRushCamp {
|
| | | public byte CampID; // 营地ID,从1开始
|
| | | public byte GoldID; // 淘金ID,为0时代表该营地为空
|
| | | public ushort RefreshCnt; // 已刷新次数
|
| | | public uint EndTime; // 预计完成时的时间戳,为0时代表还未开始淘金,通过该时间进行倒计时
|
| | | public byte WorkerCnt; // 使用监工数
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 476e02628b591b04a8c6b8c725c3d7db |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | managers.Add(AutoFightModel.Instance);
|
| | | managers.Add(MainLevelManager.Instance);
|
| | | managers.Add(BattleSettlementManager.Instance);
|
| | | managers.Add(GoldRushManager.Instance);
|
| | |
|
| | | foreach (var manager in managers)
|
| | | {
|
| | |
| | | } |
| | | |
| | | // 检查一下锤子的消耗 |
| | | if (!ItemLogicUtility.CheckCurrencyCount(41, PlayerDatas.Instance.baseData.UseHarmerCount, 2)) |
| | | if (!UIHelper.CheckMoneyCount(41, PlayerDatas.Instance.baseData.UseHarmerCount, 2)) |
| | | { |
| | | //多次防范 |
| | | if (GetBattleMode() != BattleMode.Stop) |
| | |
| | | public void Create(int _skinID, float scale = 0.8f, Action _onComplete = null, string motionName = "idle", bool isLh = false) |
| | | { |
| | | if (skinID == _skinID) |
| | | { |
| | | { |
| | | //避免重复创建 |
| | | return; |
| | | } |
| | |
| | | lhImg.SetTexture2DPNG(skinConfig.Tachie); |
| | | lhImg.SetNativeSize(); |
| | | if (skeletonGraphic != null) |
| | | { |
| | | { |
| | | skeletonGraphic.enabled = false; |
| | | } |
| | | lhImg.enabled = true; |
| | |
| | | else |
| | | { |
| | | if (skeletonGraphic != null) |
| | | { |
| | | { |
| | | skeletonGraphic.enabled = true; |
| | | } |
| | | lhImg.enabled = false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | { |
| | | this.transform.localScale = Vector3.one * scale; |
| | | } |
| | | |
| | | onComplete = _onComplete; |
| | | pool = GameObjectPoolManager.Instance.RequestPool(UILoader.LoadPrefab("UIHero")); |
| | | |
| | | |
| | | if (!transform.gameObject.activeSelf) |
| | | { |
| | | transform.SetActive(true); |
| | | } |
| | | if (instanceGO == null) |
| | | { |
| | | { |
| | | instanceGO = pool.Request(); |
| | | instanceGO.transform.SetParent(transform); |
| | | //transform 的Pivot Y是0,让instanceGO 居中 |
| | |
| | | return; |
| | | } |
| | | skeletonGraphic.Initialize(true); |
| | | |
| | | |
| | | spineAnimationState = skeletonGraphic.AnimationState; |
| | | spineAnimationState.Data.DefaultMix = 0f; |
| | | if (motionName == "") |
| | |
| | | |
| | | protected void OnDestroy() |
| | | { |
| | | if (spineAnimationState != null) |
| | | { |
| | | spineAnimationState.Complete -= OnAnimationComplete; |
| | | } |
| | | if (spineAnimationState != null) |
| | | { |
| | | spineAnimationState.Complete -= OnAnimationComplete; |
| | | } |
| | | if (pool != null) |
| | | pool.Release(instanceGO); |
| | | skeletonGraphic = null; |
| | | pool = null; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 播放 Spine 动画 |
| | | /// </summary> |
| | | /// <param name="motionName">动作名</param> |
| | | /// <param name="loop">循环</param> |
| | | /// <param name="replay">如果相同动作是否再次重播,比如跑步重播就会跳帧不顺滑</param> |
| | | public virtual void PlayAnimation(string motionName, bool loop = false, bool replay=true) |
| | | { |
| | | if (spineAnimationState == null) return; |
| | | |
| | | public virtual void PlayAnimation(string motionName, bool loop = false) |
| | | { |
| | | if (spineAnimationState == null) return; |
| | | if (GetCurrentAnimationName() == motionName && !replay) |
| | | return; |
| | | |
| | | // 直接使用 ToString() 而不是调用 GetAnimationName |
| | | spineAnimationState.SetAnimation(0, motionName.ToString(), loop); |
| | | } |
| | | spineAnimationState.SetAnimation(0, motionName.ToString(), loop); |
| | | } |
| | | |
| | | // 播放第一个动画(作为默认动画) |
| | | string GetFistSpineAnim() |
| | |
| | | Debug.LogError("Spine 数据中没有找到任何动画!武将皮肤:" + skinID); |
| | | } |
| | | return ""; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取当前正在播放的 Spine 动画名称 |
| | | /// </summary> |
| | | /// <returns>当前动画名称,如果没有动画则返回空字符串</returns> |
| | | public string GetCurrentAnimationName() |
| | | { |
| | | if (spineAnimationState == null || spineAnimationState.GetCurrent(0) == null) |
| | | { |
| | | return string.Empty; |
| | | } |
| | | return spineAnimationState.GetCurrent(0).Animation.Name; |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 动画完成事件处理 |
| | |
| | | onComplete?.Invoke(); |
| | | } |
| | | |
| | | //越大越快 |
| | | public void SetSpeed(float speed) |
| | | { |
| | | spineAnimationState.TimeScale = speed; |
| | | } |
| | | |
| | | public void SetEnabled(bool isEnable) |
| | | { |
| | | if (skeletonGraphic == null) |
| | | { |
| | | return; |
| | | } |
| | | skeletonGraphic.enabled = isEnable; |
| | | } |
| | | } |
New file |
| | |
| | | using UnityEngine; |
| | | |
| | | public class HeroModel : MonoBehaviour |
| | | { |
| | | [SerializeField] UIHeroController heroModel; |
| | | public int heroSkinID = 0; |
| | | public float scale = 1; |
| | | public string actionName = "idle"; |
| | | public bool enable = true; |
| | | |
| | | |
| | | public void Start() |
| | | { |
| | | heroModel.Create(heroSkinID, scale); |
| | | heroModel.PlayAnimation(actionName, true); |
| | | heroModel.SetEnabled(enable); |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 89cc2b60c03eb4043beae72ef97e2dd6 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | using UnityEngine.UI; |
| | | |
| | | /// <summary> |
| | | /// 内政 |
| | | /// 内政 - 基本用于淘金 |
| | | /// </summary> |
| | | public class AffairBaseWin : UIBase |
| | | { |
| | | [SerializeField] Button bagBtn; |
| | | |
| | | //淘金相关 |
| | | [SerializeField] GameObject fullGoldRush; |
| | | [SerializeField] Image goldRushIcon; |
| | | [SerializeField] Text goldRushCountText; |
| | | [SerializeField] Button goldRushItemBtn; |
| | | [SerializeField] Image goldRushItemProcess; |
| | | [SerializeField] Text autoText; |
| | | [SerializeField] GameObject flowAutoEffect; |
| | | [SerializeField] Button autoBtn; |
| | | |
| | | protected override void InitComponent() |
| | | { |
| | | bagBtn.AddListener(() => |
| | | { |
| | | UIManager.Instance.OpenWindow<RolePackWin>(); |
| | | } |
| | | { |
| | | UIManager.Instance.OpenWindow<RolePackWin>(); |
| | | } |
| | | ); |
| | | |
| | | goldRushIcon.SetIconWithMoneyType(52); |
| | | goldRushItemBtn.AddListener(() => |
| | | { |
| | | ItemTipUtility.ShowMoneyTip(52, false); |
| | | } |
| | | ); |
| | | autoBtn.AddListener(() => |
| | | { |
| | | // UIManager.Instance.OpenWindow<RolePackWin>(); |
| | | } |
| | | ); |
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | GoldRushManager.Instance.OnGoldRushCampEvent += OnGoldRushCampEvent; |
| | | GoldRushManager.Instance.OnGoldRushInfoEvent += OnGoldRushInfoEvent; |
| | | GoldRushManager.Instance.OnAutoWorkingEvent += OnAutoWorkingEvent; |
| | | GlobalTimeEvent.Instance.secondEvent += OnSecondEvent; |
| | | PlayerDatas.Instance.playerDataRefreshEvent += PlayerDataRefreshEvent; |
| | | Display(); |
| | | GoldRushManager.Instance.GetAllAward(); |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | GoldRushManager.Instance.OnGoldRushCampEvent -= OnGoldRushCampEvent; |
| | | GoldRushManager.Instance.OnGoldRushInfoEvent -= OnGoldRushInfoEvent; |
| | | GoldRushManager.Instance.OnAutoWorkingEvent -= OnAutoWorkingEvent; |
| | | GlobalTimeEvent.Instance.secondEvent -= OnSecondEvent; |
| | | PlayerDatas.Instance.playerDataRefreshEvent -= PlayerDataRefreshEvent; |
| | | } |
| | | |
| | | void Display() |
| | | { |
| | | fullGoldRush.SetActive(GoldRushManager.Instance.GetWarehouseCnt() >= GoldRushManager.Instance.maxWorkerCount); |
| | | RefreshGoldRushMoney(); |
| | | autoText.text = Language.Get(GoldRushManager.Instance.isAutoWorking ? "GoldRush34" : "GoldRush24"); |
| | | } |
| | | |
| | | void OnGoldRushCampEvent(int campID) |
| | | { |
| | | } |
| | | |
| | | void OnGoldRushInfoEvent() |
| | | { |
| | | fullGoldRush.SetActive(GoldRushManager.Instance.GetWarehouseCnt() >= GoldRushManager.Instance.maxWorkerCount); |
| | | } |
| | | |
| | | void OnSecondEvent() |
| | | { |
| | | RefreshGoldRushMoney(); |
| | | } |
| | | |
| | | void OnAutoWorkingEvent() |
| | | { |
| | | if (GoldRushManager.Instance.isAutoWorking) |
| | | { |
| | | autoText.text = Language.Get("GoldRush34"); |
| | | flowAutoEffect.SetActive(true); |
| | | |
| | | } |
| | | else |
| | | { |
| | | autoText.text = Language.Get("GoldRush24"); |
| | | flowAutoEffect.SetActive(false); |
| | | } |
| | | } |
| | | |
| | | void RefreshGoldRushMoney() |
| | | { |
| | | var count = UIHelper.GetMoneyCnt(52); |
| | | if (count > 0) |
| | | { |
| | | goldRushCountText.text = count + "/" + GoldRushManager.Instance.goldRushMissionMaxCnt; |
| | | } |
| | | else |
| | | { |
| | | //倒计时 |
| | | goldRushCountText.text = TimeUtility.SecondsToMS(GoldRushManager.Instance.restoreMissionSeconds - (TimeUtility.AllSeconds - GoldRushManager.Instance.lastRecoverTime)); |
| | | } |
| | | goldRushItemProcess.fillAmount = (float)count / GoldRushManager.Instance.goldRushMissionMaxCnt; |
| | | } |
| | | |
| | | void PlayerDataRefreshEvent(PlayerDataType type) |
| | | { |
| | | if (type == PlayerDataType.GoldRush) |
| | | { |
| | | RefreshGoldRushMoney(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | public class AffairFuncCell : MonoBehaviour |
| | | { |
| | | [SerializeField] Image lockImg; |
| | | [SerializeField] ImageEx titleBG; |
| | | [SerializeField] Text titleText; |
| | | [SerializeField] Button funcBtn; |
| | | public int funcID; |
| | | |
| | | void Start() |
| | | { |
| | | funcBtn.AddListener(OnClickFunc); |
| | | } |
| | | |
| | | void OnEnable() |
| | | { |
| | | if (funcID != 0 &&FuncOpen.Instance.IsFuncOpen(funcID)) |
| | | { |
| | | lockImg.SetActive(false); |
| | | titleBG.gray = false; |
| | | //DED4C8 |
| | | titleText.color = new Color32(222, 212, 200, 255); |
| | | } |
| | | else |
| | | { |
| | | lockImg.SetActive(true); |
| | | titleBG.gray = true; |
| | | titleText.color = UIHelper.GetUIColor(TextColType.Gray); |
| | | } |
| | | |
| | | } |
| | | |
| | | void OnClickFunc() |
| | | { |
| | | if (!FuncOpen.Instance.IsFuncOpen(funcID, true)) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | if (funcID == 8) |
| | | { |
| | | UIManager.Instance.OpenWindow<GoldRushWorkerWin>(); |
| | | } |
| | | // else if (funcID == 214) |
| | | // { |
| | | // GoldRushManager.Instance.NotifyGoldRushEvent(0, 0, 2); |
| | | // } |
| | | |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 1174ff753f469044dbcaba6514326b56 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using DG.Tweening; |
| | | using Cysharp.Threading.Tasks; |
| | | using System; |
| | | |
| | | public class GoldRushLeader : MonoBehaviour |
| | | { |
| | | [SerializeField] UIHeroController leader; //监工 |
| | | // [SerializeField] GameObject goods; |
| | | [SerializeField] RectTransform leaderGo; |
| | | [SerializeField] UIAlphaTween leaderWord; |
| | | [SerializeField] Text leaderText; |
| | | public float leaderScale = 0.6f; |
| | | |
| | | public Tween leaderSequence; |
| | | private int leaderPosIndex = -1; //监工已达移动点 |
| | | private int state = 0; //0 站岗(不显示) 1 前进 2 空手返程 3 货物返程(不中断) |
| | | |
| | | int tendID; |
| | | GoldRushPosEvent[] leaderPathPointArr; //监工移动点 |
| | | |
| | | Action<bool> OnComplete; |
| | | |
| | | public void Init(GoldRushPosEvent[] _leaderPathPointArr, float waitTime, int _tendID, bool isBack, Action<bool> _OnComplete) |
| | | { |
| | | tendID = _tendID; |
| | | leaderPathPointArr = _leaderPathPointArr; |
| | | leaderPosIndex = !isBack ? -1: leaderPathPointArr.Length - 1; |
| | | state = 0; |
| | | leaderWord.Stop(); |
| | | leaderWord.SetEndState(); |
| | | // goods.SetActive(isBack); |
| | | leaderGo.localPosition = !isBack ? leaderPathPointArr[0].transform.localPosition : |
| | | leaderPathPointArr[leaderPathPointArr.Length - 1].transform.localPosition; |
| | | OnComplete = _OnComplete; |
| | | this.SetActive(true); |
| | | leader.Create(GoldRushManager.Instance.GetRandommSkinID(), leaderScale); |
| | | Go(waitTime, isBack).Forget(); |
| | | } |
| | | |
| | | |
| | | |
| | | async UniTask Go(float waitTime, bool isBack) |
| | | { |
| | | int delayTime = Math.Max(1, (int)(waitTime * 1000)); |
| | | await UniTask.Delay(delayTime); |
| | | StartLeaderMove(isBack); |
| | | } |
| | | |
| | | public void StartLeaderMove(bool isBack) |
| | | { |
| | | leaderSequence.Kill(); |
| | | |
| | | leaderWord.Stop(); |
| | | leaderWord.SetEndState(); |
| | | LeaderMove(isBack); |
| | | |
| | | } |
| | | |
| | | void LeaderMove(bool isBack) |
| | | { |
| | | int moveIndex = isBack ? leaderPosIndex - 1 : leaderPosIndex + 1; |
| | | //判断事件, 返程用当前点事件,出发用下一个点的事件 |
| | | GoldRushPosEvent pathPosEvent = isBack ? leaderPathPointArr[leaderPosIndex] : leaderPathPointArr[moveIndex]; |
| | | |
| | | if (moveIndex <= 0) |
| | | { |
| | | moveIndex = 0; |
| | | } |
| | | else if (moveIndex >= leaderPathPointArr.Length) |
| | | { |
| | | moveIndex = leaderPathPointArr.Length - 1; |
| | | } |
| | | |
| | | Vector3 nextPos = leaderPathPointArr[moveIndex].transform.localPosition; |
| | | leader.PlayAnimation("run", true, false); |
| | | |
| | | leaderPosIndex = moveIndex; |
| | | bool isRush = pathPosEvent.m_PosEvent == PosEvent.Rush; |
| | | bool isJump = pathPosEvent.m_PosEvent == PosEvent.Jump; |
| | | |
| | | leader.SetSpeed((isRush ? 2 : 1) * (isBack ? 0.5f : 1)); |
| | | |
| | | |
| | | var dis = Vector3.Distance(leaderGo.localPosition, nextPos); |
| | | var duration = dis / pathPosEvent.m_Speed / (isBack ? pathPosEvent.m_BackSlowSpeedScale : 1); |
| | | |
| | | // Debug.Log("第" + workerIndex + "个工人" + " duration" + duration + " 移动index " + moveIndex + " Time=" + Time.time); |
| | | if (leaderGo.localPosition.x < nextPos.x) |
| | | { |
| | | leader.transform.localRotation = Quaternion.Euler(0, 0, 0); |
| | | } |
| | | else |
| | | { |
| | | //转向 |
| | | leader.transform.localRotation = Quaternion.Euler(0, 180, 0); |
| | | } |
| | | |
| | | PathEvent(pathPosEvent, isBack); |
| | | |
| | | if (!isJump) |
| | | { |
| | | leaderSequence = leaderGo.DOLocalMove(nextPos, duration).SetEase(pathPosEvent.m_EaseType); |
| | | } |
| | | else |
| | | { |
| | | //抛物线跳跃 |
| | | // 计算抛物线路径点 |
| | | Vector3[] path = new Vector3[3]; |
| | | path[0] = leaderGo.localPosition; // 起点 |
| | | //顶点x 是两者之间 y增加高度 |
| | | path[1] = new Vector3(nextPos[0] + (leaderGo.localPosition.x - nextPos[0]) / 2, nextPos[1] + pathPosEvent.m_Value1, nextPos.z); |
| | | path[2] = nextPos; // 终点 |
| | | |
| | | // 使用 DOPath 实现抛物线移动 |
| | | leaderSequence = leaderGo.DOLocalPath(path, pathPosEvent.m_Value2, PathType.CatmullRom).SetEase(pathPosEvent.m_EaseType); |
| | | } |
| | | leaderSequence.OnComplete(() => |
| | | { |
| | | // Debug.Log("Sequence completed for worker " + workerIndex); |
| | | if (moveIndex == (isBack ? 0 : leaderPathPointArr.Length - 1)) |
| | | { |
| | | leader.PlayAnimation("idle", true, false); |
| | | leader.transform.localRotation = Quaternion.Euler(0, 0, 0); |
| | | |
| | | this.SetActive(false); |
| | | OnComplete(isBack); |
| | | return; |
| | | } |
| | | LeaderMove(isBack); |
| | | }); |
| | | |
| | | } |
| | | |
| | | void PathEvent(GoldRushPosEvent pathPosEvent, bool isBack) |
| | | { |
| | | if (isBack) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | if (pathPosEvent.m_PosEvent == PosEvent.TargetFollow) |
| | | { |
| | | // StartMove(isBack); |
| | | GoldRushManager.Instance.NotifyPathEvent(pathPosEvent.m_PosEvent, isBack, tendID, 0, ""); |
| | | } |
| | | else if (pathPosEvent.m_PosEvent == PosEvent.Word) |
| | | { |
| | | leaderWord.SetActive(true); |
| | | leaderWord.Play(); |
| | | leaderText.text = Language.Get(pathPosEvent.m_Text1); |
| | | } |
| | | else if (pathPosEvent.m_PosEvent == PosEvent.TargetWord) |
| | | { |
| | | |
| | | if (!pathPosEvent.m_IsRandom) |
| | | { |
| | | //指定语言 |
| | | if (pathPosEvent.m_Value1 <= 0) |
| | | { |
| | | //全体说话 |
| | | for (int i = 0; i < GoldRushManager.followWorkerCount; i++) |
| | | { |
| | | GoldRushManager.Instance.NotifyPathEvent(pathPosEvent.m_PosEvent, isBack, tendID, i, pathPosEvent.m_Text1); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //单个说话 |
| | | GoldRushManager.Instance.NotifyPathEvent(pathPosEvent.m_PosEvent, isBack, tendID, (int)pathPosEvent.m_Value1 - 1, pathPosEvent.m_Text1); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //随机全体说话 |
| | | for (int i = 0; i < GoldRushManager.followWorkerCount; i++) |
| | | { |
| | | GoldRushManager.Instance.NotifyPathEvent(pathPosEvent.m_PosEvent, isBack, tendID, i, |
| | | pathPosEvent.m_Text1 + UnityEngine.Random.Range((int)pathPosEvent.m_Value1, (int)pathPosEvent.m_Value2)); |
| | | } |
| | | } |
| | | } |
| | | else if (pathPosEvent.m_PosEvent == PosEvent.TargetAction) |
| | | { |
| | | for (int i = 0; i < GoldRushManager.followWorkerCount; i++) |
| | | { |
| | | GoldRushManager.Instance.NotifyPathEvent(pathPosEvent.m_PosEvent, isBack, tendID, i, pathPosEvent.m_Text1); |
| | | } |
| | | } |
| | | else if (pathPosEvent.m_PosEvent == PosEvent.Action) |
| | | { |
| | | leader.PlayAnimation(pathPosEvent.m_Text1); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 5883f3be9e7c13d42b68d2ac570a9bf6 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using System;
|
| | | using LitJson;
|
| | |
|
| | | using System.Collections.Generic;
|
| | |
|
| | | //淘金功能
|
| | | public class GoldRushManager : GameSystemManager<GoldRushManager>
|
| | | {
|
| | | public const int funcID = 8;
|
| | | int campUnlockState;
|
| | | int workerUnlockState;
|
| | | public int panningCnt; //累计总次数
|
| | | public int lastRecoverTime; // 上次免费恢复淘金令时间戳,为0时可不用倒计时
|
| | | public int housekeeperEndTime; // 自动管家到期时间戳,有值同时也代表免费试用已使用
|
| | | public byte[] warehouseIDList;
|
| | | public Dictionary<int, HB037_tagSCGoldRushCampInfo.tagSCGoldRushCamp> campInfoDict = new Dictionary<int, HB037_tagSCGoldRushCampInfo.tagSCGoldRushCamp>();
|
| | |
|
| | | public event Action<int> OnGoldRushCampEvent; //服务端通知营地信息
|
| | | public event Action OnGoldRushInfoEvent;
|
| | |
|
| | |
|
| | | //行为事件
|
| | | public event Action<int> OnRefreshItemEvent; //刷新淘金道具
|
| | | public event Action<int, int, int> GoldRushEvent; //营地ID,执行事件(0出发,1返程),监工数量
|
| | | public event Action<PosEvent, bool, int, int, string> PathEvent; //事件,是否返程,营地ID,第几个工人,聊天内容(后续考虑传结构数据)
|
| | |
|
| | | public const int followWorkerCount = 3; //小兵的数量,非监工
|
| | |
|
| | | int m_MaxWorkerCount; //配表的最大数量
|
| | | //监工的数量,解锁影响
|
| | | public int maxWorkerCount
|
| | | {
|
| | | get
|
| | | {
|
| | | int count = 0;
|
| | | for (int i = 1; i <= m_MaxWorkerCount; i++)
|
| | | {
|
| | | if (IsWorkerUnLock(i))
|
| | | {
|
| | | count++;
|
| | | }
|
| | | }
|
| | | return count;
|
| | | }
|
| | | }
|
| | | public List<int> skinIDs = new List<int>(); //随机的监工皮肤 ,已解锁
|
| | |
|
| | | public int selectCampID;
|
| | | bool m_IsAutoWorking; //是否暂停
|
| | | //是否在执行自动管家,没有淘金令时暂停,仓库满暂停
|
| | | public bool isAutoWorking
|
| | | {
|
| | | get
|
| | | {
|
| | | return m_IsAutoWorking && isOpenAuto;
|
| | | }
|
| | | }
|
| | | public bool isOpenAuto; //是否开启自动管家,重登会取消
|
| | |
|
| | | public event Action OnAutoWorkingEvent;
|
| | |
|
| | |
|
| | | //配置
|
| | | public int refreshMoneyType;
|
| | | public int[] refreshMoneyList;
|
| | | public Dictionary<int, int> itemIDUnLockFuncIDDict = new Dictionary<int, int>();
|
| | |
|
| | | bool openAutoGoldRush
|
| | | {
|
| | | get
|
| | | {
|
| | | return housekeeperEndTime > 0 && TimeUtility.AllSeconds < housekeeperEndTime;
|
| | | }
|
| | | }
|
| | |
|
| | | //淘金仓库(已完成任务未领取的存储)上限
|
| | | int warehouseBaseCnt;
|
| | | int warehouseAddCnt;
|
| | | public int warehouseMaxCnt
|
| | | {
|
| | | get
|
| | | {
|
| | | return warehouseBaseCnt + (openAutoGoldRush ? warehouseAddCnt : 0);
|
| | | }
|
| | | }
|
| | |
|
| | | //淘金令(任务未做的)上限
|
| | | int goldRushMissionBaseCnt;
|
| | | int goldRushMissionAddCnt;
|
| | | public int goldRushMissionMaxCnt
|
| | | {
|
| | | get
|
| | | {
|
| | | return goldRushMissionBaseCnt + (openAutoGoldRush ? goldRushMissionAddCnt : 0);
|
| | | }
|
| | | }
|
| | |
|
| | | public int restoreMissionSeconds; //自动恢复任务时间
|
| | |
|
| | | public int freeAutoDays; //免费试用天数
|
| | |
|
| | | public List<int> buyAutoDaysList = new List<int>(); //购买自动管家天数
|
| | | public List<int> buyAutoCTGIDList = new List<int>(); //购买自动管家CTGID
|
| | |
|
| | | public PlayerDataType unLockMoneyType; //刷新用
|
| | |
|
| | | public override void Init()
|
| | | {
|
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEventOnRelogin += OnBeforePlayerDataInitialize;
|
| | | PlayerDatas.Instance.playerDataRefreshEvent += OnPlayerDataRefresh;
|
| | |
|
| | | m_MaxWorkerCount = GoldRushWorkerConfig.GetKeys().Count;
|
| | |
|
| | | ParseConfig();
|
| | | }
|
| | |
|
| | | public override void Release()
|
| | | {
|
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEventOnRelogin -= OnBeforePlayerDataInitialize;
|
| | | PlayerDatas.Instance.playerDataRefreshEvent -= OnPlayerDataRefresh;
|
| | | }
|
| | |
|
| | | void ParseConfig()
|
| | | {
|
| | | var config = FuncConfigConfig.Get("GoldRushRefresh");
|
| | | refreshMoneyType = int.Parse(config.Numerical2);
|
| | | refreshMoneyList = JsonMapper.ToObject<int[]>(config.Numerical3);
|
| | | itemIDUnLockFuncIDDict = ConfigParse.ParseIntDict(config.Numerical5);
|
| | |
|
| | | config = FuncConfigConfig.Get("GoldRush");
|
| | | var countArr = ConfigParse.GetMultipleStr<int>(config.Numerical1);
|
| | | warehouseBaseCnt = countArr[0];
|
| | | warehouseAddCnt = countArr[1];
|
| | | countArr = ConfigParse.GetMultipleStr<int>(config.Numerical2);
|
| | | goldRushMissionBaseCnt = countArr[0];
|
| | | goldRushMissionAddCnt = countArr[1];
|
| | | restoreMissionSeconds = int.Parse(config.Numerical3) * 60;
|
| | |
|
| | | config = FuncConfigConfig.Get("GoldRushAuto");
|
| | | var tmpArr = JsonMapper.ToObject<int[]>(config.Numerical1);
|
| | | freeAutoDays = tmpArr[0];
|
| | | for (int i = 1; i < tmpArr.Length; i++)
|
| | | {
|
| | | buyAutoDaysList.Add(tmpArr[i]);
|
| | | }
|
| | | var tmpArr2 = JsonMapper.ToObject<int[][]>(config.Numerical2);
|
| | | for (int i = 0; i < tmpArr2.Length; i++)
|
| | | {
|
| | | buyAutoCTGIDList.Add(tmpArr2[i][0]);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | void OnBeforePlayerDataInitialize()
|
| | | {
|
| | | campUnlockState = 0;
|
| | | workerUnlockState = 0;
|
| | | panningCnt = 0;
|
| | | housekeeperEndTime = 0;
|
| | | warehouseIDList = new byte[0];
|
| | | lastRecoverTime = 0;
|
| | | campInfoDict.Clear();
|
| | | isOpenAuto = false;
|
| | | }
|
| | |
|
| | | |
| | |
|
| | | void OnPlayerDataRefresh(PlayerDataType type)
|
| | | {
|
| | | //unLockMoneyType未赋值则不会刷新 减少运行
|
| | | if (type == unLockMoneyType)
|
| | | {
|
| | | UpdateRedpoint();
|
| | | }
|
| | | else if (type == PlayerDataType.GoldRush)
|
| | | {
|
| | | SetAutoWorking(isOpenAuto, UIHelper.GetMoneyCnt(52) > 0);
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | public int GetRandommSkinID()
|
| | | {
|
| | | //从已解锁中随机
|
| | | return skinIDs[UnityEngine.Random.Range(0, skinIDs.Count)];
|
| | | }
|
| | |
|
| | | void RefreshUnLockSkinID()
|
| | | {
|
| | | skinIDs.Clear();
|
| | | foreach (var item in GoldRushWorkerConfig.GetValues())
|
| | | {
|
| | | if (IsWorkerUnLock(item.WorkerID))
|
| | | {
|
| | | skinIDs.Add(item.SkinID);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public void UpdateGoldRushInfo(HB036_tagSCGoldRushInfo netPack)
|
| | | {
|
| | | campUnlockState = (int)netPack.CampState;
|
| | | if (workerUnlockState != netPack.WorkerState)
|
| | | { |
| | | workerUnlockState = (int)netPack.WorkerState;
|
| | | RefreshUnLockSkinID();
|
| | | }
|
| | | panningCnt = (int)netPack.PanningCnt;
|
| | | housekeeperEndTime = (int)netPack.HousekeeperEndTime;
|
| | | warehouseIDList = netPack.WarehouseIDList;
|
| | | lastRecoverTime = (int)netPack.LastRecoverTime;
|
| | | UpdateRedpoint();
|
| | | OnGoldRushInfoEvent?.Invoke();
|
| | | }
|
| | |
|
| | | public void UpdateGoldRushCampInfo(HB037_tagSCGoldRushCampInfo netPack)
|
| | | {
|
| | | for (int i = 0; i < netPack.CampCnt; i++)
|
| | | {
|
| | | campInfoDict[netPack.CampList[i].CampID] = netPack.CampList[i]; ;
|
| | | OnGoldRushCampEvent?.Invoke(netPack.CampList[i].CampID);
|
| | | }
|
| | | UpdateRedpoint();
|
| | |
|
| | | }
|
| | |
|
| | | //获取淘金仓库总量含正在执行的
|
| | | public int GetWarehouseCnt()
|
| | | {
|
| | | //排查0
|
| | | int cnt = 0;
|
| | | foreach (var item in warehouseIDList)
|
| | | {
|
| | | if (item != 0)
|
| | | {
|
| | | cnt++;
|
| | | }
|
| | | }
|
| | | foreach (var item in campInfoDict.Values)
|
| | | {
|
| | | if (item.GoldID != 0 && item.EndTime != 0)
|
| | | { |
| | | cnt++;
|
| | | }
|
| | | }
|
| | | return cnt;
|
| | | }
|
| | |
|
| | | //获取淘金ID
|
| | | public int GetCampGoldID(int campID)
|
| | | {
|
| | | if (campInfoDict.ContainsKey(campID))
|
| | | {
|
| | | return campInfoDict[campID].GoldID;
|
| | | }
|
| | | return 0;
|
| | | }
|
| | |
|
| | | //获取营地工人
|
| | | public int GetCampWorkerCnt(int campID)
|
| | | {
|
| | | if (campInfoDict.ContainsKey(campID))
|
| | | {
|
| | | return campInfoDict[campID].WorkerCnt;
|
| | | }
|
| | | return 0;
|
| | | }
|
| | |
|
| | | public int GetEmptyWorkerCount()
|
| | | {
|
| | | int count = 0;
|
| | | foreach (var item in campInfoDict.Values)
|
| | | {
|
| | | count += item.WorkerCnt;
|
| | | }
|
| | | return maxWorkerCount - count;
|
| | | }
|
| | |
|
| | | //获取营地刷新次数
|
| | | public int GetCampRefreshCnt(int campID)
|
| | | {
|
| | | if (campInfoDict.ContainsKey(campID))
|
| | | {
|
| | | return campInfoDict[campID].RefreshCnt;
|
| | | }
|
| | | return 0;
|
| | | }
|
| | |
|
| | | //获取营地结束时间,0代表未开始
|
| | | public int GetCampEndTime(int campID)
|
| | | {
|
| | | if (campInfoDict.ContainsKey(campID))
|
| | | {
|
| | | if (campInfoDict[campID].GoldID == 0)
|
| | | {
|
| | | return 0;
|
| | | }
|
| | | return (int)campInfoDict[campID].EndTime;
|
| | | }
|
| | | return 0;
|
| | | }
|
| | |
|
| | |
|
| | | public string GetCampItemName(GoldRushItemConfig config)
|
| | | {
|
| | | return UIHelper.AppendColor(config.ItemLV, Language.Get("L1113", config.ItemLV) + " " + ItemConfig.Get(config.ItemID).ItemName);
|
| | | }
|
| | |
|
| | |
|
| | | //营地是否已解锁
|
| | | public bool IsCampUnLock(int campID)
|
| | | {
|
| | | return (campUnlockState & (1 << campID)) != 0;
|
| | | }
|
| | |
|
| | | //工人是否已解锁
|
| | | public bool IsWorkerUnLock(int workerID)
|
| | | {
|
| | | return (workerUnlockState & (1 << workerID)) != 0;
|
| | | }
|
| | |
|
| | | // 0-发布淘金(消耗淘金令);1-刷新淘金;2-开始淘金或调整监工数;3-取消淘金
|
| | | public void SendGoldRushOP(int opType, int campID, int workerCnt)
|
| | | {
|
| | | var pack = new CB036_tagCSGoldRushOP();
|
| | | pack.OPType = (byte)opType;
|
| | | pack.CampID = (byte)campID;
|
| | | pack.WorkerCnt = (byte)workerCnt;
|
| | | GameNetSystem.Instance.SendInfo(pack);
|
| | | if (opType <= 1)
|
| | | { |
| | | OnRefreshItemEvent?.Invoke(campID);
|
| | | }
|
| | | }
|
| | |
|
| | | //解锁 0-营地;1-监工
|
| | | public void SendGoldRushUnlock(int unlockType, int id)
|
| | | {
|
| | | var pack = new CB037_tagCSGoldRushUnlock();
|
| | | pack.UnlockType = (byte)unlockType;
|
| | | pack.UnlockID = (byte)id;
|
| | | GameNetSystem.Instance.SendInfo(pack);
|
| | | }
|
| | |
|
| | | public void SendGoldRushWarehouseAward(int index, int isAll)
|
| | | { |
| | | var pack = new CB038_tagCSGoldRushWarehouseAward();
|
| | | pack.AwardIndex = (byte)index;
|
| | | pack.IsAll = (byte)isAll;
|
| | | GameNetSystem.Instance.SendInfo(pack);
|
| | | }
|
| | |
|
| | | public void GetAllAward()
|
| | | {
|
| | | if (CheckHasFinishGoldRush())
|
| | | { |
| | | SendGoldRushWarehouseAward(0, 1);
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | //通知外出行为事件
|
| | | public void NotifyGoldRushEvent(int campID, int eventType, int leaderCount)
|
| | | {
|
| | | GoldRushEvent?.Invoke(campID, eventType, leaderCount);
|
| | | }
|
| | |
|
| | | //通知路径行为事件
|
| | | public void NotifyPathEvent(PosEvent posEvent, bool isBack, int tendID, int index, string content)
|
| | | {
|
| | | PathEvent?.Invoke(posEvent, isBack, tendID, index, content);
|
| | | }
|
| | |
|
| | |
|
| | | //红点:可领取,可解锁的监工
|
| | | Redpoint redpoint = new Redpoint(MainRedDot.MainAffairsRedpoint, MainRedDot.BlessedLandRedpoint);
|
| | |
|
| | | //可解锁的监工
|
| | | Redpoint workerRedpoint = new Redpoint(MainRedDot.BlessedLandRedpoint, MainRedDot.BlessedLandRedpoint * 10 + 1);
|
| | | |
| | | //可领取的奖励
|
| | | Redpoint awardRedpoint = new Redpoint(MainRedDot.BlessedLandRedpoint, MainRedDot.BlessedLandRedpoint * 10 + 2);
|
| | | //营地解锁红点
|
| | | Redpoint campRedpoint = new Redpoint(MainRedDot.MainAffairsRedpoint, MainRedDot.BlessedLandRedpoint * 10);
|
| | |
|
| | | void UpdateRedpoint()
|
| | | {
|
| | | if (CheckCanUnLockWorker())
|
| | | {
|
| | | workerRedpoint.state = RedPointState.Simple;
|
| | | }
|
| | | else
|
| | | {
|
| | | workerRedpoint.state = RedPointState.None;
|
| | | }
|
| | |
|
| | | if (CheckHasFinishGoldRush())
|
| | | {
|
| | | awardRedpoint.state = RedPointState.Simple;
|
| | | }
|
| | | else
|
| | | {
|
| | | awardRedpoint.state = RedPointState.None;
|
| | | }
|
| | |
|
| | |
|
| | | campRedpoint.state = CheckCanUnLockCamp() ? RedPointState.Simple : RedPointState.None;
|
| | | }
|
| | |
|
| | | //玩家数据类型
|
| | | void InitUnlockMoney(int type)
|
| | | {
|
| | | unLockMoneyType = UIHelper.moneyTypeToPlayerDataType[type];
|
| | | }
|
| | |
|
| | | //检查是否有可解锁的监工
|
| | | bool CheckCanUnLockWorker()
|
| | | {
|
| | | foreach (var workerID in GoldRushWorkerConfig.GetKeys())
|
| | | {
|
| | | if (IsWorkerUnLock(workerID))
|
| | | {
|
| | | continue;
|
| | | }
|
| | | var config = GoldRushWorkerConfig.Get(workerID);
|
| | | if (config.MoneyUnlock.Length != 0)
|
| | | {
|
| | | InitUnlockMoney(config.MoneyUnlock[0]);
|
| | |
|
| | | if (UIHelper.GetMoneyCnt(config.MoneyUnlock[0]) < config.MoneyUnlock[1])
|
| | | {
|
| | | continue;
|
| | | }
|
| | | }
|
| | |
|
| | | if (config.PlayerLVUnlock != 0 && PlayerDatas.Instance.baseData.LV < config.PlayerLVUnlock)
|
| | | {
|
| | | continue;
|
| | | }
|
| | |
|
| | | return true;
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | bool CheckHasFinishGoldRush()
|
| | | {
|
| | | //非0
|
| | | foreach (var id in warehouseIDList)
|
| | | {
|
| | | if (id != 0)
|
| | | {
|
| | | return true;
|
| | | }
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | //检查是否有可解锁的营地
|
| | | bool CheckCanUnLockCamp()
|
| | | {
|
| | | foreach (var campID in GoldRushCampConfig.GetKeys())
|
| | | {
|
| | | if (IsCampUnLock(campID))
|
| | | {
|
| | | continue;
|
| | | }
|
| | |
|
| | | var config = GoldRushCampConfig.Get(campID);
|
| | | if (config.MoneyUnlock.Length != 0)
|
| | | {
|
| | | InitUnlockMoney(config.MoneyUnlock[0]);
|
| | |
|
| | | if (UIHelper.GetMoneyCnt(config.MoneyUnlock[0]) < config.MoneyUnlock[1])
|
| | | {
|
| | | continue;
|
| | | }
|
| | | }
|
| | |
|
| | | if (config.PanningUnlock != 0 && panningCnt < config.PanningUnlock)
|
| | | {
|
| | | continue;
|
| | | }
|
| | |
|
| | |
|
| | | return true;
|
| | |
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | |
|
| | | //0 已解锁 1 次数锁 2 金钱锁
|
| | | public int GetCampLockState(int campID)
|
| | | {
|
| | | if (IsCampUnLock(campID))
|
| | | {
|
| | | return 0;
|
| | | }
|
| | | var config = GoldRushCampConfig.Get(campID);
|
| | | if (config.PanningUnlock != 0)
|
| | | {
|
| | | return 1;
|
| | | }
|
| | |
|
| | | if (config.MoneyUnlock.Length != 0)
|
| | | {
|
| | | return 2;
|
| | | }
|
| | |
|
| | | return 0;
|
| | |
|
| | | }
|
| | |
|
| | | //自动淘金 先填充营地 再填充多个监工
|
| | |
|
| | | void SetAutoWorking(bool _isOpenAuto, bool _isAutoWorking)
|
| | | { |
| | | isOpenAuto = _isOpenAuto;
|
| | | m_IsAutoWorking = _isAutoWorking;
|
| | | OnAutoWorkingEvent?.Invoke();
|
| | | }
|
| | | }
|
| | |
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 5469d328bac371545a71f569744fc63f |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using DG.Tweening; |
| | | using UnityEngine; |
| | | |
| | | public class GoldRushPosEvent : MonoBehaviour |
| | | { |
| | | [Header("所有点都是移动目的地,附加事件不同")] |
| | | public PosEvent m_PosEvent; |
| | | public Ease m_EaseType = Ease.Linear; |
| | | public float m_Speed = 200; |
| | | public float m_BackSlowSpeedScale = 0.5f; //带货物回程速度放慢百分比 |
| | | public bool m_IsRandom = false; |
| | | |
| | | public float m_Value1 = 0; |
| | | public float m_Value2 = 0; |
| | | public string m_Text1 = string.Empty; |
| | | |
| | | |
| | | } |
| | | |
| | | public enum PosEvent |
| | | { |
| | | Move, |
| | | Rush, |
| | | Jump, |
| | | Word, //武将自己聊天 |
| | | Action, |
| | | TargetFollow, //指定营地跟随 |
| | | TargetWord, //聊天 |
| | | TargetAction, |
| | | } |
| | | |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 2604f54884b49b74ab9f64c9fdd9532a |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using System; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | |
| | | /// <summary> |
| | | /// 淘金刷新界面 |
| | | /// </summary> |
| | | public class GoldRushRefreshWin : UIBase |
| | | { |
| | | [SerializeField] ItemCell itemCell; |
| | | [SerializeField] Text nameText; |
| | | [SerializeField] CountControler countControler; |
| | | |
| | | [SerializeField] Text timeText; |
| | | [SerializeField] Text moneyText; |
| | | [SerializeField] Image iconImg; |
| | | |
| | | [SerializeField] Transform refreshRect; |
| | | [SerializeField] ButtonEx refreshBtn; |
| | | [SerializeField] ButtonEx workBtn; |
| | | [SerializeField] ButtonEx callBackBtn; |
| | | [SerializeField] Text callBackText; |
| | | [SerializeField] Text workingText; |
| | | |
| | | GoldRushItemConfig config; |
| | | int workerCount; |
| | | |
| | | protected override void InitComponent() |
| | | { |
| | | workBtn.AddListener(DoingWork); |
| | | refreshBtn.AddListener(RefreshItem); |
| | | callBackBtn.AddListener(CallBackWorker); |
| | | } |
| | | |
| | | |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | GoldRushManager.Instance.OnGoldRushCampEvent += OnGoldRushCampEvent; |
| | | GlobalTimeEvent.Instance.secondEvent += OnSecondEvent; |
| | | var goldID = GoldRushManager.Instance.GetCampGoldID(GoldRushManager.Instance.selectCampID); |
| | | if (goldID == 0) |
| | | { |
| | | DelayCloseWindow().Forget(); |
| | | return; |
| | | } |
| | | |
| | | |
| | | Display(); |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | GoldRushManager.Instance.OnGoldRushCampEvent -= OnGoldRushCampEvent; |
| | | GlobalTimeEvent.Instance.secondEvent -= OnSecondEvent; |
| | | } |
| | | |
| | | |
| | | void Display() |
| | | { |
| | | var goldID = GoldRushManager.Instance.GetCampGoldID(GoldRushManager.Instance.selectCampID); |
| | | config = GoldRushItemConfig.Get(goldID); |
| | | int emptyCnt = GoldRushManager.Instance.GetEmptyWorkerCount(); |
| | | |
| | | itemCell.Init(new ItemCellModel(config.ItemID, false, config.ItemCount)); |
| | | nameText.text = GoldRushManager.Instance.GetCampItemName(config); |
| | | var endTime = GoldRushManager.Instance.GetCampEndTime(GoldRushManager.Instance.selectCampID); |
| | | if (endTime == 0) |
| | | { |
| | | //未开始 |
| | | timeText.text = TimeUtility.SecondsToMS(config.NeedSeconds); |
| | | refreshRect.SetActive(true); |
| | | callBackBtn.SetActive(false); |
| | | |
| | | iconImg.SetIconWithMoneyType(GoldRushManager.Instance.refreshMoneyType); |
| | | moneyText.text = UIHelper.ShowUseMoney(GoldRushManager.Instance.refreshMoneyType, GetRefreshMoney()); |
| | | workBtn.SetInteractable(emptyCnt != 0); |
| | | workerCount = Math.Min(emptyCnt, 1); |
| | | } |
| | | else |
| | | { |
| | | timeText.text = TimeUtility.SecondsToMS(endTime - TimeUtility.AllSeconds); |
| | | refreshRect.SetActive(false); |
| | | callBackBtn.SetActive(true); |
| | | RefreshCallBackBtn(); |
| | | workerCount = GoldRushManager.Instance.GetCampWorkerCnt(GoldRushManager.Instance.selectCampID); |
| | | } |
| | | countControler.Init(ChangeWorkerCount, config.WorkerMax, workerCount, AddWorker, DecWorker); |
| | | } |
| | | |
| | | void RefreshCallBackBtn() |
| | | { |
| | | var realCnt = GoldRushManager.Instance.GetCampWorkerCnt(GoldRushManager.Instance.selectCampID); |
| | | if (workerCount == 0) |
| | | { |
| | | callBackBtn.SetInteractable(true); |
| | | callBackText.text = Language.Get("GoldRush33"); //撤回监工 |
| | | } |
| | | else if (realCnt == workerCount) |
| | | { |
| | | callBackBtn.SetInteractable(false); |
| | | callBackText.text = Language.Get("GoldRush14"); //调整监工 |
| | | } |
| | | else |
| | | { |
| | | callBackBtn.SetInteractable(true); |
| | | callBackText.text = Language.Get("GoldRush14"); //调整监工 |
| | | } |
| | | } |
| | | |
| | | void OnSecondEvent() |
| | | { |
| | | var endTime = GoldRushManager.Instance.GetCampEndTime(GoldRushManager.Instance.selectCampID); |
| | | if (endTime != 0) |
| | | { |
| | | timeText.text = TimeUtility.SecondsToMS(endTime - TimeUtility.AllSeconds); |
| | | |
| | | var addStr = new string('.', (int)Time.time % 4); |
| | | workingText.text = Language.Get("GoldRush37") + addStr; |
| | | } |
| | | } |
| | | |
| | | int GetRefreshMoney() |
| | | { |
| | | var refreshCnt = GoldRushManager.Instance.GetCampRefreshCnt(GoldRushManager.Instance.selectCampID); |
| | | return GoldRushManager.Instance.refreshMoneyList[Math.Min(refreshCnt, GoldRushManager.Instance.refreshMoneyList.Length - 1)]; |
| | | } |
| | | |
| | | void OnGoldRushCampEvent(int campID) |
| | | { |
| | | if (campID != GoldRushManager.Instance.selectCampID) |
| | | { |
| | | return; |
| | | } |
| | | var goldID = GoldRushManager.Instance.GetCampGoldID(GoldRushManager.Instance.selectCampID); |
| | | if (goldID == 0) |
| | | { |
| | | //已完成 |
| | | CloseWindow(); |
| | | return; |
| | | } |
| | | Display(); |
| | | } |
| | | |
| | | void ChangeWorkerCount(int count) |
| | | { |
| | | workerCount = count; |
| | | var endTime = GoldRushManager.Instance.GetCampEndTime(GoldRushManager.Instance.selectCampID); |
| | | if (endTime == 0) |
| | | { |
| | | //未开始 |
| | | timeText.text = TimeUtility.SecondsToMS(config.NeedSeconds / Math.Max(1, count)); |
| | | } |
| | | else |
| | | { |
| | | timeText.text = TimeUtility.SecondsToMS(endTime - TimeUtility.AllSeconds); |
| | | RefreshCallBackBtn(); |
| | | } |
| | | } |
| | | |
| | | bool AddWorker(int count) |
| | | { |
| | | if (count >= config.WorkerMax) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | //可派遣的监工: 空闲监工数+当前监工数 |
| | | if (count + 1 > GoldRushManager.Instance.GetEmptyWorkerCount() + GoldRushManager.Instance.GetCampWorkerCnt(GoldRushManager.Instance.selectCampID)) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("GoldRush2"); |
| | | return false; |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | bool DecWorker(int count) |
| | | { |
| | | if (count <= 0) |
| | | return false; |
| | | return true; |
| | | } |
| | | |
| | | void DoingWork() |
| | | { |
| | | var endTime = GoldRushManager.Instance.GetCampEndTime(GoldRushManager.Instance.selectCampID); |
| | | if (endTime != 0) |
| | | return; |
| | | |
| | | int emptyCnt = GoldRushManager.Instance.GetEmptyWorkerCount(); |
| | | if (emptyCnt == 0 || workerCount > emptyCnt) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("GoldRush2"); |
| | | return; |
| | | } |
| | | |
| | | if (workerCount == 0) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("GoldRush5"); |
| | | return; |
| | | } |
| | | |
| | | if (workerCount > config.WorkerMax) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | //仓库容量已达上限 |
| | | if (GoldRushManager.Instance.GetWarehouseCnt() >= GoldRushManager.Instance.warehouseMaxCnt) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("GoldRush3"); |
| | | return; |
| | | } |
| | | |
| | | GoldRushManager.Instance.SendGoldRushOP(2, GoldRushManager.Instance.selectCampID, workerCount); |
| | | CloseWindow(); |
| | | } |
| | | |
| | | void RefreshItem() |
| | | { |
| | | var endTime = GoldRushManager.Instance.GetCampEndTime(GoldRushManager.Instance.selectCampID); |
| | | if (endTime != 0) |
| | | return; |
| | | |
| | | |
| | | if (!UIHelper.CheckMoneyCount(GoldRushManager.Instance.refreshMoneyType, GetRefreshMoney(), 2)) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | GoldRushManager.Instance.SendGoldRushOP(1, GoldRushManager.Instance.selectCampID, 0); |
| | | |
| | | SysNotifyMgr.Instance.ShowTip("GoldRush4"); |
| | | } |
| | | |
| | | void CallBackWorker() |
| | | { |
| | | var endTime = GoldRushManager.Instance.GetCampEndTime(GoldRushManager.Instance.selectCampID); |
| | | if (endTime == 0) |
| | | return; |
| | | |
| | | var realCnt = GoldRushManager.Instance.GetCampWorkerCnt(GoldRushManager.Instance.selectCampID); |
| | | if (workerCount == 0) |
| | | { |
| | | ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), |
| | | Language.Get("GoldRush38"), (bool isOK) => |
| | | { |
| | | if (isOK) |
| | | { |
| | | //撤回监工 |
| | | GoldRushManager.Instance.SendGoldRushOP(3, GoldRushManager.Instance.selectCampID, 0); |
| | | CloseWindow(); |
| | | } |
| | | }); |
| | | } |
| | | else if (realCnt == workerCount) |
| | | { |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | //调整监工 |
| | | GoldRushManager.Instance.SendGoldRushOP(2, GoldRushManager.Instance.selectCampID, workerCount); |
| | | CloseWindow(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: f639ca533ace96b4c9513432ec376a35 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using DG.Tweening; |
| | | |
| | | //工人是固定的跟随模式,监工是随机分配的,场上的监工数量会比实际更多 |
| | | //分配监工 |
| | | // 1.分配都是新的监工 一定从起点开始 |
| | | // 2.撤回的可以从半路撤回 |
| | | public class GoldRushTentCell : MonoBehaviour |
| | | { |
| | | [SerializeField] Button tentBtn; |
| | | [SerializeField] GameObject funcGo; |
| | | [SerializeField] GameObject lockCntGo; //淘金次数解锁 |
| | | [SerializeField] Text lockCntText; |
| | | [SerializeField] Button unLockBtn; |
| | | [SerializeField] GameObject lockMoneyGo; |
| | | [SerializeField] Button unlockMoneyBtn; //货币解锁 |
| | | [SerializeField] Image unlockMoneyIcon; |
| | | [SerializeField] Text unlockMoneyText; |
| | | [SerializeField] GameObject goldRushMissionWaitGo; //未发布任务 |
| | | [SerializeField] GameObject goldRushMissionWorkingGo; //已发布任务 |
| | | [SerializeField] Text goldRushItemText; |
| | | [SerializeField] Image workingProcess; |
| | | [SerializeField] UIEffectPlayer refreshItemEffect; |
| | | [SerializeField] Text workingText; //外出中 |
| | | |
| | | |
| | | [SerializeField] UIHeroController[] workerArr; //小兵跟随 |
| | | [SerializeField] RectTransform[] workerGoArr; |
| | | [SerializeField] RectTransform[] hidePosArr; //未解锁时 屏幕外坐标 |
| | | [SerializeField] RectTransform[] startPosArr; //起点 站岗坐标 |
| | | [SerializeField] GoldRushPosEvent[] pathPointArr; //移动点 |
| | | [SerializeField] UIAlphaTween[] wordArr; |
| | | [SerializeField] Text[] textArr; |
| | | [SerializeField] GoldRushLeader tmpLeader; //监工 |
| | | [SerializeField] Transform leaderParent; |
| | | [SerializeField] GoldRushPosEvent[] leaderPathPointArr; |
| | | public int campID = 0; |
| | | |
| | | //小兵工人 |
| | | Tween[] sequenceArr = new Tween[3]; |
| | | Dictionary<int, int> workerPosDic = new Dictionary<int, int>(); //工人已达移动点 |
| | | |
| | | List<GoldRushLeader> workingLeaderList = new List<GoldRushLeader>(); //正在工作的监工 和分配列表一致 |
| | | List<GoldRushLeader> callBackLeaderList = new List<GoldRushLeader>(); //返程的监工(完工的 和 被召回的) |
| | | Queue<GoldRushLeader> poolLeaderList = new Queue<GoldRushLeader>(); //监工池 |
| | | |
| | | int workState = -1; // - 1未解锁 0 站岗 1 前进 2 返程 |
| | | int leaderCount = 0; //当前监工数量 |
| | | void Start() |
| | | { |
| | | Init(); |
| | | tentBtn.AddListener(ClickTent); |
| | | unlockMoneyBtn.AddListener(ClickUnlockMoney); |
| | | unLockBtn.AddListener(ClickUnlock); |
| | | } |
| | | |
| | | |
| | | void OnEnable() |
| | | { |
| | | GoldRushManager.Instance.GoldRushEvent += GoldRushEvent; |
| | | GoldRushManager.Instance.PathEvent += PathEvent; |
| | | GoldRushManager.Instance.OnGoldRushCampEvent += OnGoldRushCampEvent; |
| | | GoldRushManager.Instance.OnGoldRushInfoEvent += Display; |
| | | GoldRushManager.Instance.OnRefreshItemEvent += OnRefreshItemEvent; |
| | | GlobalTimeEvent.Instance.secondEvent += OnSecondEvent; |
| | | leaderCount = GoldRushManager.Instance.GetCampWorkerCnt(campID); |
| | | Display(); |
| | | |
| | | } |
| | | |
| | | void OnDisable() |
| | | { |
| | | GoldRushManager.Instance.GoldRushEvent -= GoldRushEvent; |
| | | GoldRushManager.Instance.PathEvent -= PathEvent; |
| | | GoldRushManager.Instance.OnGoldRushCampEvent -= OnGoldRushCampEvent; |
| | | GoldRushManager.Instance.OnGoldRushInfoEvent -= Display; |
| | | GoldRushManager.Instance.OnRefreshItemEvent -= OnRefreshItemEvent; |
| | | GlobalTimeEvent.Instance.secondEvent -= OnSecondEvent; |
| | | } |
| | | |
| | | void FixFollowWoker(int lockState) |
| | | { |
| | | //跟随小兵如果在外出中,且没有监工,则隐藏 |
| | | if (workingLeaderList.Count == 0 && callBackLeaderList.Count == 0 && workState <= 0 |
| | | && GoldRushManager.Instance.GetCampEndTime(campID) != 0) |
| | | { |
| | | for (int i = 0; i < workerArr.Length; i++) |
| | | { |
| | | workerGoArr[i].localPosition = hidePosArr[i].localPosition; |
| | | } |
| | | return; |
| | | } |
| | | |
| | | // 初始状态 |
| | | if (lockState != 0) |
| | | { |
| | | //未解锁 显示隐藏坐标 |
| | | for (int i = 0; i < workerArr.Length; i++) |
| | | { |
| | | workerGoArr[i].localPosition = hidePosArr[i].localPosition; |
| | | } |
| | | } |
| | | else if (workState == -1 && lockState == 0) |
| | | { |
| | | //解锁的时候,如果不在起点则跑步过去 |
| | | workState = 0; |
| | | for (int i = 0; i < sequenceArr.Length; i++) |
| | | { |
| | | sequenceArr[i].Kill(); |
| | | var worker = workerArr[i]; |
| | | worker.PlayAnimation("run", true, false); |
| | | sequenceArr[i] = workerGoArr[i].DOLocalMove(startPosArr[i].localPosition, 1f).SetEase(Ease.Linear); |
| | | |
| | | sequenceArr[i].OnComplete(() => |
| | | { |
| | | worker.PlayAnimation("idle", true, false); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | void OnGoldRushCampEvent(int _campID) |
| | | { |
| | | if (_campID != campID) |
| | | return; |
| | | |
| | | var realCount = GoldRushManager.Instance.GetCampWorkerCnt(campID); |
| | | if (realCount > leaderCount) |
| | | { |
| | | //分配监工 |
| | | GoldRushManager.Instance.NotifyGoldRushEvent(campID, 0, realCount - leaderCount); |
| | | } |
| | | else if (realCount < leaderCount) |
| | | { |
| | | //召回监工 |
| | | GoldRushManager.Instance.NotifyGoldRushEvent(campID, 1, leaderCount - realCount); |
| | | } |
| | | leaderCount = realCount; |
| | | Display(); |
| | | } |
| | | |
| | | void OnRefreshItemEvent(int _campID) |
| | | { |
| | | if (_campID != campID) |
| | | return; |
| | | |
| | | refreshItemEffect.Play(); |
| | | } |
| | | |
| | | void Display() |
| | | { |
| | | if (!FuncOpen.Instance.IsFuncOpen(GoldRushManager.funcID)) |
| | | { |
| | | funcGo.SetActive(false); |
| | | return; |
| | | } |
| | | funcGo.SetActive(true); |
| | | |
| | | var campConfig = GoldRushCampConfig.Get(campID); |
| | | int lockState = GoldRushManager.Instance.GetCampLockState(campID); |
| | | if (lockState == 1) |
| | | { |
| | | if (GoldRushManager.Instance.panningCnt < campConfig.PanningUnlock) |
| | | { |
| | | lockCntGo.SetActive(true); |
| | | unLockBtn.SetActive(false); |
| | | lockCntText.text = Language.Get("GoldRush32", GoldRushManager.Instance.panningCnt, campConfig.PanningUnlock); |
| | | } |
| | | else |
| | | { |
| | | lockCntGo.SetActive(false); |
| | | unLockBtn.SetActive(true); |
| | | } |
| | | lockMoneyGo.SetActive(false); |
| | | goldRushMissionWaitGo.SetActive(false); |
| | | goldRushMissionWorkingGo.SetActive(false); |
| | | } |
| | | else if (lockState == 2) |
| | | { |
| | | lockCntGo.SetActive(false); |
| | | unLockBtn.SetActive(false); |
| | | lockMoneyGo.SetActive(true); |
| | | |
| | | unlockMoneyIcon.SetIconWithMoneyType(campConfig.MoneyUnlock[0]); |
| | | unlockMoneyText.text = campConfig.MoneyUnlock[1].ToString(); |
| | | goldRushMissionWaitGo.SetActive(false); |
| | | goldRushMissionWorkingGo.SetActive(false); |
| | | } |
| | | else |
| | | { |
| | | lockCntGo.SetActive(false); |
| | | unLockBtn.SetActive(false); |
| | | lockMoneyGo.SetActive(false); |
| | | var goldID = GoldRushManager.Instance.GetCampGoldID(campID); |
| | | if (goldID == 0) |
| | | { |
| | | goldRushMissionWaitGo.SetActive(true); |
| | | goldRushMissionWorkingGo.SetActive(false); |
| | | } |
| | | else |
| | | { |
| | | goldRushMissionWaitGo.SetActive(false); |
| | | goldRushMissionWorkingGo.SetActive(true); |
| | | var goldConfig = GoldRushItemConfig.Get(goldID); |
| | | goldRushItemText.text = GoldRushManager.Instance.GetCampItemName(goldConfig); |
| | | |
| | | var endTime = GoldRushManager.Instance.GetCampEndTime(campID); |
| | | if (endTime == 0) |
| | | { |
| | | //未开始 |
| | | workingText.text = ""; |
| | | workingProcess.fillAmount = 0; |
| | | } |
| | | else |
| | | { |
| | | //按原总时长当进度条 |
| | | workingProcess.fillAmount = (goldConfig.NeedSeconds - (GoldRushManager.Instance.GetCampEndTime(campID) - TimeUtility.AllSeconds)) / (float)goldConfig.NeedSeconds; |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | FixFollowWoker(lockState); |
| | | } |
| | | |
| | | void OnSecondEvent() |
| | | { |
| | | //进度条和 外出中文字 |
| | | int lockState = GoldRushManager.Instance.GetCampLockState(campID); |
| | | if (lockState != 0) |
| | | { |
| | | return; |
| | | } |
| | | var goldID = GoldRushManager.Instance.GetCampGoldID(campID); |
| | | if (goldID == 0) |
| | | { |
| | | return; |
| | | } |
| | | var endTime = GoldRushManager.Instance.GetCampEndTime(campID); |
| | | if (endTime == 0) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | var addStr = new string('.', (int)Time.time % 4); |
| | | workingText.text = Language.Get("GoldRush37") + addStr; |
| | | var goldConfig = GoldRushItemConfig.Get(goldID); |
| | | //按原总时长当进度条 |
| | | workingProcess.fillAmount = (goldConfig.NeedSeconds - (GoldRushManager.Instance.GetCampEndTime(campID) - TimeUtility.AllSeconds)) / (float)goldConfig.NeedSeconds; |
| | | |
| | | } |
| | | |
| | | void GoldRushEvent(int _campID, int eventType, int leaderCount) |
| | | { |
| | | if (_campID != campID) |
| | | { |
| | | return; |
| | | } |
| | | if (eventType == 0) |
| | | { |
| | | //出发 |
| | | AssignLeader(leaderCount); |
| | | } |
| | | else if (eventType == 1) |
| | | { |
| | | //返程 |
| | | CallBackLeader(leaderCount); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | void Init() |
| | | { |
| | | for (int i = 0; i < workerArr.Length; i++) |
| | | { |
| | | workerPosDic[i] = -1; //-1代表起点,站岗坐标 |
| | | wordArr[i].SetEndState(); |
| | | } |
| | | } |
| | | |
| | | public void StartMove(bool isBack) |
| | | { |
| | | for (int i = 0; i < sequenceArr.Length; i++) |
| | | { |
| | | sequenceArr[i].Kill(); |
| | | WorkerMove(isBack, i); |
| | | } |
| | | |
| | | } |
| | | |
| | | void WorkerMove(bool isBack, int workerIndex) |
| | | { |
| | | var worker = workerArr[workerIndex]; |
| | | var workerGo = workerGoArr[workerIndex]; |
| | | int curIndex = workerPosDic[workerIndex]; |
| | | int moveIndex = isBack ? curIndex - 1 : curIndex + 1; |
| | | |
| | | |
| | | GoldRushPosEvent pathPosEvent = isBack ? pathPointArr[curIndex] : pathPointArr[moveIndex]; //判断事件, 当前点或者下一个点 |
| | | |
| | | Vector3 nextPos; |
| | | if (moveIndex <= -1) |
| | | { |
| | | moveIndex = -1; |
| | | nextPos = startPosArr[workerIndex].localPosition; |
| | | } |
| | | else |
| | | { |
| | | if (moveIndex >= pathPointArr.Length) |
| | | { |
| | | moveIndex = pathPointArr.Length - 1; |
| | | } |
| | | nextPos = pathPointArr[moveIndex].transform.localPosition; |
| | | } |
| | | worker.PlayAnimation("run", true, false); |
| | | |
| | | workerPosDic[workerIndex] = moveIndex; |
| | | bool isRush = pathPosEvent.m_PosEvent == PosEvent.Rush; |
| | | bool isJump = pathPosEvent.m_PosEvent == PosEvent.Jump; |
| | | |
| | | worker.SetSpeed((isRush ? 2 : 1) * (isBack ? 0.5f : 1)); |
| | | |
| | | // 先出发的终点要往前一点 |
| | | Vector3 offset = Vector3.zero; |
| | | if (moveIndex == pathPointArr.Length - 1) |
| | | { |
| | | offset = new Vector3((pathPointArr.Length - workerIndex - 1) * 80, 0, 0); |
| | | } |
| | | var endPos = nextPos - offset; |
| | | |
| | | var dis = Vector3.Distance(workerGo.localPosition, endPos); |
| | | var duration = dis / pathPosEvent.m_Speed / (isBack ? pathPosEvent.m_BackSlowSpeedScale : 1); |
| | | |
| | | // Debug.Log("第" + workerIndex + "个工人" + " duration" + duration + " 移动index " + moveIndex + " Time=" + Time.time); |
| | | if (workerGo.localPosition.x < endPos.x) |
| | | { |
| | | worker.transform.localRotation = Quaternion.Euler(0, 0, 0); |
| | | } |
| | | else |
| | | { |
| | | //转向 |
| | | worker.transform.localRotation = Quaternion.Euler(0, 180, 0); |
| | | } |
| | | if (!isJump) |
| | | { |
| | | sequenceArr[workerIndex] = workerGo.DOLocalMove(endPos, duration).SetEase(pathPosEvent.m_EaseType); |
| | | } |
| | | else |
| | | { |
| | | //抛物线跳跃 |
| | | // 计算抛物线路径点 |
| | | Vector3[] path = new Vector3[3]; |
| | | path[0] = workerGo.localPosition; // 起点 |
| | | //顶点x 是两者之间 y增加高度 |
| | | path[1] = new Vector3(endPos[0] + (workerGo.localPosition.x - endPos[0]) / 2, endPos[1] + pathPosEvent.m_Value1, nextPos.z); |
| | | path[2] = endPos; // 终点 |
| | | |
| | | // 使用 DOPath 实现抛物线移动 |
| | | sequenceArr[workerIndex] = workerGo.DOLocalPath(path, pathPosEvent.m_Value2, PathType.CatmullRom).SetEase(pathPosEvent.m_EaseType); |
| | | } |
| | | sequenceArr[workerIndex].OnComplete(() => |
| | | { |
| | | // Debug.Log("Sequence completed for worker " + workerIndex); |
| | | if (moveIndex == (isBack ? -1 : pathPointArr.Length - 1)) |
| | | { |
| | | worker.PlayAnimation("idle", true, false); |
| | | worker.transform.localRotation = Quaternion.Euler(0, 0, 0); |
| | | if (moveIndex == -1) |
| | | { |
| | | workState = 0; |
| | | } |
| | | return; |
| | | } |
| | | |
| | | WorkerMove(isBack, workerIndex); |
| | | }); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | void PathEvent(PosEvent posEvent, bool isBack, int _tendID, int index, string content) |
| | | { |
| | | if (_tendID != campID) |
| | | return; |
| | | |
| | | if (posEvent == PosEvent.TargetFollow) |
| | | { |
| | | if (isBack) |
| | | return; |
| | | // 已经在外出中不跟随 |
| | | if (workState == 1) |
| | | return; |
| | | StartMove(false); |
| | | workState = 1; |
| | | } |
| | | |
| | | else if (posEvent == PosEvent.TargetWord) |
| | | { |
| | | wordArr[index].SetActive(true); |
| | | wordArr[index].Play(); |
| | | textArr[index].text = Language.Get(content); |
| | | } |
| | | else if (posEvent == PosEvent.TargetAction) |
| | | { |
| | | for (int i = 0; i < wordArr.Length; i++) |
| | | { |
| | | workerArr[i].PlayAnimation(content); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | void AssignLeader(int addCount) |
| | | { |
| | | //分配的时候加新的监工 |
| | | for (int i = 0; i < addCount; i++) |
| | | { |
| | | float waitTime = i * 0.6f; |
| | | var newLeader = RequestLeader(); |
| | | workingLeaderList.Add(newLeader); |
| | | newLeader.Init(leaderPathPointArr, waitTime, campID, false, (bool value) => |
| | | { |
| | | if (!value) |
| | | { |
| | | workingLeaderList.Remove(newLeader); |
| | | ReturnLeader(newLeader); |
| | | } |
| | | else |
| | | { |
| | | //半路返回的监工 |
| | | callBackLeaderList.Add(newLeader); |
| | | ReturnLeader(newLeader); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | GoldRushLeader RequestLeader() |
| | | { |
| | | if (poolLeaderList.Count == 0) |
| | | { |
| | | return Instantiate(tmpLeader, leaderParent); |
| | | } |
| | | return poolLeaderList.Dequeue(); |
| | | } |
| | | |
| | | void ReturnLeader(GoldRushLeader leader) |
| | | { |
| | | poolLeaderList.Enqueue(leader); |
| | | } |
| | | |
| | | |
| | | //半路召回的,拉货回来的 |
| | | void CallBackLeader(int callBackCount) |
| | | { |
| | | bool followBack = false; |
| | | //从workingLeaderList 中取出最后面调回的监工,不够的新建 |
| | | for (int i = 0; i < callBackCount; i++) |
| | | { |
| | | if (workingLeaderList.Count > 0) |
| | | { |
| | | //半路拉回来的 |
| | | var leader = workingLeaderList[workingLeaderList.Count - 1]; |
| | | //原样显示 |
| | | callBackLeaderList.Add(leader); |
| | | workingLeaderList.Remove(leader); |
| | | leader.StartLeaderMove(true); |
| | | if (workingLeaderList.Count == 0 && workState == 1) |
| | | { |
| | | followBack = true; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //需要显示货物 |
| | | float waitTime = i * 0.6f; |
| | | var newLeader = RequestLeader(); |
| | | callBackLeaderList.Add(newLeader); |
| | | newLeader.Init(leaderPathPointArr, waitTime, campID, true, (bool value) => |
| | | { |
| | | if (value) |
| | | { |
| | | //返回的监工,需要显示货物 |
| | | callBackLeaderList.Add(newLeader); |
| | | ReturnLeader(newLeader); |
| | | } |
| | | }); |
| | | if (workingLeaderList.Count == 0 && workState == 1) |
| | | { |
| | | followBack = true; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (followBack) |
| | | { |
| | | StartMove(true); |
| | | workState = 2; |
| | | } |
| | | } |
| | | |
| | | void ClickTent() |
| | | { |
| | | if (!FuncOpen.Instance.IsFuncOpen(GoldRushManager.funcID)) |
| | | { |
| | | return; |
| | | } |
| | | var lockState = GoldRushManager.Instance.GetCampLockState(campID); |
| | | if (lockState != 0) |
| | | { |
| | | return; |
| | | } |
| | | var goldID = GoldRushManager.Instance.GetCampGoldID(campID); |
| | | if (goldID != 0) |
| | | { |
| | | GoldRushManager.Instance.selectCampID = campID; |
| | | UIManager.Instance.OpenWindow<GoldRushRefreshWin>(); |
| | | return; |
| | | } |
| | | |
| | | if (!UIHelper.CheckMoneyCount(52, 1, 1)) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | GoldRushManager.Instance.SendGoldRushOP(0, campID, 0); |
| | | } |
| | | |
| | | void ClickUnlockMoney() |
| | | { |
| | | int lockState = GoldRushManager.Instance.GetCampLockState(campID); |
| | | if (lockState != 2) |
| | | { |
| | | return; |
| | | } |
| | | var config = GoldRushCampConfig.Get(campID); |
| | | |
| | | ConfirmCancel.MoneyIconToggleConfirmByType(ToggleCheckType.GoldRush, config.MoneyUnlock[1], config.MoneyUnlock[0], |
| | | Language.Get("GoldRush35", UIHelper.GetIconNameWithMoneyType(config.MoneyUnlock[0]), config.MoneyUnlock[1]), () => |
| | | { |
| | | if (!UIHelper.CheckMoneyCount(config.MoneyUnlock[0], config.MoneyUnlock[1], 2)) |
| | | { |
| | | return; |
| | | } |
| | | GoldRushManager.Instance.SendGoldRushUnlock(0, campID); |
| | | refreshItemEffect.Play(); |
| | | }); |
| | | |
| | | |
| | | } |
| | | |
| | | //达到可解锁条件 需手动解锁 |
| | | void ClickUnlock() |
| | | { |
| | | int lockState = GoldRushManager.Instance.GetCampLockState(campID); |
| | | if (lockState != 1) |
| | | { |
| | | return; |
| | | } |
| | | var config = GoldRushCampConfig.Get(campID); |
| | | if (GoldRushManager.Instance.panningCnt < config.PanningUnlock) |
| | | return; |
| | | |
| | | GoldRushManager.Instance.SendGoldRushUnlock(0, campID); |
| | | refreshItemEffect.Play(); |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: aa12fac436eef3a458155d427ae5ad4e |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | |
| | | //淘金中信息列表显示 |
| | | public class GoldRushWorkCell : CellView |
| | | { |
| | | [SerializeField] ItemCell itemCell; |
| | | [SerializeField] Text nameText; |
| | | [SerializeField] Text timeText; |
| | | [SerializeField] Slider slider; |
| | | [SerializeField] CountControler countControler; |
| | | |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 6bef7211ba539124a8039c45117dbcfb |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | |
| | | //淘金工人的列表显示 |
| | | public class GoldRushWorkerCell : CellView |
| | | { |
| | | [SerializeField] Button tentBtn; |
| | | |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 6ce961bc85dcad74c89a295e6d8c4cd4 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using System; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | |
| | | /// <summary> |
| | | /// 淘金派遣总管理 |
| | | /// </summary> |
| | | public class GoldRushWorkerWin : UIBase |
| | | { |
| | | [SerializeField] GroupButtonEx workMgrBtn; //派遣管理 |
| | | [SerializeField] GroupButtonEx workersBtn; //监工人员管理 |
| | | |
| | | [SerializeField] Transform workMgrRect; |
| | | [SerializeField] Transform workersRect; |
| | | |
| | | //派遣管理 |
| | | [SerializeField] ScrollerController workMgrScroller; |
| | | [SerializeField] Transform workMgrEmpty; |
| | | [SerializeField] Text lazyWorkerCntText; //空闲监工数量 |
| | | [SerializeField] Text warehouseCntText; //仓库数量 |
| | | [SerializeField] Button getAllAwardBtn; |
| | | |
| | | //监工人员管理 |
| | | [SerializeField] ScrollerController workersScroller; |
| | | [SerializeField] Text unlockWorkerCntText; //解锁监工数量 |
| | | [SerializeField] Text totalWorkFinishCount; //淘金完成总次数 |
| | | |
| | | |
| | | protected override void InitComponent() |
| | | { |
| | | workMgrBtn.AddListener(OnWorkMgrBtnClick); |
| | | workersBtn.AddListener(OnWorkerBtnClick); |
| | | } |
| | | |
| | | |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | |
| | | if (functionOrder == 0) |
| | | { |
| | | workMgrBtn.SelectBtn(); |
| | | } |
| | | else |
| | | { |
| | | workersBtn.SelectBtn(); |
| | | } |
| | | Display(); |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | } |
| | | |
| | | |
| | | void Display() |
| | | { |
| | | if (functionOrder == 0) |
| | | { |
| | | DispalyWorkMgr(); |
| | | } |
| | | else |
| | | { |
| | | DispalyWorkers(); |
| | | } |
| | | } |
| | | |
| | | void DispalyWorkMgr() |
| | | { |
| | | workMgrRect.SetActive(true); |
| | | workersRect.SetActive(false); |
| | | } |
| | | |
| | | void DispalyWorkers() |
| | | { |
| | | workMgrRect.SetActive(false); |
| | | workersRect.SetActive(true); |
| | | } |
| | | |
| | | void OnWorkMgrBtnClick() |
| | | { |
| | | functionOrder = 0; |
| | | Display(); |
| | | } |
| | | |
| | | void OnWorkerBtnClick() |
| | | { |
| | | functionOrder = 1; |
| | | Display(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: aaf329a6e30c71f4c973aa257e265e8b |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | public static TipData mainTipData { get; private set; } // 注意当递进点击打开多个tip界面会变更数据,不能依赖此值 |
| | | public static TipData secondaryData { get; private set; } |
| | | |
| | | public static void ShowMoneyTip(int moneyType) |
| | | public static void ShowMoneyTip(int moneyType, bool showGetWay = true) |
| | | { |
| | | if (GeneralDefine.MoneyDisplayModel.ContainsKey(moneyType)) |
| | | { |
| | | Show(GeneralDefine.MoneyDisplayModel[moneyType], true); |
| | | Show(GeneralDefine.MoneyDisplayModel[moneyType], showGetWay); |
| | | } |
| | | else |
| | | { |
| | |
| | | return isEnough;
|
| | | }
|
| | |
|
| | | /// <param name="needTips">0 不响应 1 弹提示 2 弹获取途径tips</param>
|
| | | public static bool CheckCurrencyCount(int moneyType, long needCount, int needTips = 0)
|
| | | {
|
| | | if (needCount <= 0)
|
| | | {
|
| | | return true;
|
| | | }
|
| | |
|
| | | long haveCount = UIHelper.GetMoneyCnt(moneyType);
|
| | |
|
| | | bool isEnough = haveCount >= needCount;
|
| | |
|
| | | if (!isEnough)
|
| | | {
|
| | | if (needTips == 1)
|
| | | {
|
| | | SysNotifyMgr.Instance.ShowTip("LackMoney", moneyType);
|
| | | }
|
| | | else if (needTips == 2)
|
| | | {
|
| | | ItemTipUtility.ShowMoneyTip(moneyType);
|
| | | }
|
| | | }
|
| | |
|
| | | return isEnough;
|
| | | }
|
| | | |
| | |
|
| | | public event Action<string> GetBetterEquipEvent; //得到更好的装备 value 物品的实例ID
|
| | |
|
| | |
| | | return; |
| | | } |
| | | |
| | | if (!ItemLogicUtility.CheckCurrencyCount(41, PlayerDatas.Instance.baseData.UseHarmerCount, 2)) |
| | | if (!UIHelper.CheckMoneyCount(41, PlayerDatas.Instance.baseData.UseHarmerCount, 2)) |
| | | { |
| | | if (storyBattleField.GetBattleMode() != BattleMode.Stop) |
| | | storyBattleField.HaveRest(); |
| | |
| | | public readonly Redpoint fairyActivityRedpoint = new Redpoint(218);
|
| | | #endregion
|
| | |
|
| | | public static int BlessLVRedpoint = 399; //祝福等级红点
|
| | | public static int DailySpecialsRedpoint = 439; //每日特惠入口红点
|
| | | public const int BlessLVRedpoint = 399; //祝福等级红点
|
| | | public const int DailySpecialsRedpoint = 439; //每日特惠入口红点
|
| | |
|
| | | public static int BlessedLandRedpoint = 444; //福地红点
|
| | | public const int BlessedLandRedpoint = 444; //淘金红点
|
| | | public const int CustomizedGiftRedpoint = 448; //自选礼包
|
| | | public const int LoginZhanLingRedpoint = 449; //登录战令
|
| | | public const int PhantasmPavilionRepoint = 459; //幻境阁
|
| | |
| | | public static string generalItemTip; |
| | | public static string generalItemTip2; |
| | | |
| | | public static int moneyType; |
| | | public static int moneyNeedCount; |
| | | |
| | | public static List<Item> getItems { get; private set; } |
| | | public static string replaceItemName; |
| | | /// <summary> |
| | |
| | | } |
| | | |
| | | |
| | | public static void MoneyIconToggleConfirmByType(ToggleCheckType type, int moneyCnt, int _moneyType, string fullTip, Action func) |
| | | { |
| | | if (toggleCheckDict.ContainsKey(type) && toggleCheckDict[type]) |
| | | { |
| | | func?.Invoke(); |
| | | return; |
| | | } |
| | | |
| | | public static string moneyTitle; |
| | | public static string moneyTopInfo; |
| | | public static string moneybtnOkText; |
| | | public static int moneyType; |
| | | public static int moneyNeedCount; |
| | | public static ulong moneyHaveCount; |
| | | public static string moneyToggleText { get; private set; } |
| | | public static bool moneytoggleOpen { get; private set; } |
| | | public static bool moneytoggleOpenState { get; private set; } |
| | | MoneyIconToggleConfirm(moneyCnt, _moneyType, fullTip, Language.Get("ConfirmCancel102"), (bool isOk, bool isToggle) => |
| | | { |
| | | if (isOk) |
| | | { |
| | | func?.Invoke(); |
| | | toggleCheckDict[type] = isToggle; |
| | | } |
| | | |
| | | // public static Action<bool, bool> OnMoneyToggleConfirmAct; |
| | | // public static void MoneyIconToggleConfirm(string title, string topInfo,string okTxt, int type, |
| | | // int needCnt, ulong haveCnt, Action<bool, bool> func, bool toggleOpen = false, string toggleTxt = "", bool toggleOpenState = false) |
| | | // { |
| | | // moneyTitle = title; |
| | | // moneyTopInfo = topInfo; |
| | | // moneybtnOkText = okTxt; |
| | | // moneyType = type; |
| | | // moneyNeedCount = needCnt; |
| | | // moneyHaveCount = haveCnt; |
| | | // moneyToggleText = toggleTxt; |
| | | // moneytoggleOpen = toggleOpen; |
| | | // moneytoggleOpenState = toggleOpenState; |
| | | // OnMoneyToggleConfirmAct = func; |
| | | // if (!UIManager.Instance.IsOpened<MoneyIconToggleConfirmWin>()) |
| | | // { |
| | | // UIManager.Instance.OpenWindow<MoneyIconToggleConfirmWin>(); |
| | | // } |
| | | // } |
| | | }); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | public static Action<bool, bool> OnMoneyToggleConfirmAct; |
| | | public static void MoneyIconToggleConfirm(int moneyCnt, int _moneyType, string content, string toggleTxt, Action<bool, bool> func, bool _toggle = false) |
| | | { |
| | | generalContent = content; |
| | | toggleContent = toggleTxt; |
| | | OnToggleConfirmEvent = func; |
| | | toggleOpenState = _toggle; |
| | | moneyType = _moneyType; |
| | | moneyNeedCount = moneyCnt; |
| | | if (!UIManager.Instance.IsOpened<MoneyIconToggleConfirmWin>()) |
| | | { |
| | | UIManager.Instance.OpenWindow<MoneyIconToggleConfirmWin>(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | { |
| | | Auction = 0, //拍卖行 |
| | | WashCancel = 1, //洗练取消 |
| | | GoldRush = 2, //淘金 |
| | | } |
| | | |
| | | |
New file |
| | |
| | | /* |
| | | * @Author: 玩个游戏 |
| | | * @Date: 2025-09-25 15:16:21 |
| | | */ |
| | | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | // 显示货币的勾选确认框,按钮标题等信息需要更改的话 后续补充 |
| | | public class MoneyIconToggleConfirmWin : UIBase |
| | | { |
| | | [SerializeField] Text m_Content; |
| | | [SerializeField] Text m_ToggleTxt; |
| | | [SerializeField] Toggle m_Toggle; |
| | | [SerializeField] Button m_ConfirmBtn; |
| | | [SerializeField] Button m_CancelBtn; |
| | | [SerializeField] Text moneyText; |
| | | [SerializeField] Image moneyIcon; |
| | | protected override void InitComponent() |
| | | { |
| | | m_ConfirmBtn.AddListener(OnConfirm); |
| | | m_CancelBtn.AddListener(OnCancel); |
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | m_Content.text = ConfirmCancel.generalContent; |
| | | m_ToggleTxt.text = ConfirmCancel.toggleContent; |
| | | m_Toggle.isOn = ConfirmCancel.toggleOpenState; |
| | | |
| | | moneyText.text = UIHelper.ShowUseMoney(ConfirmCancel.moneyType, ConfirmCancel.moneyNeedCount); |
| | | moneyIcon.SetIconWithMoneyType(ConfirmCancel.moneyType); |
| | | // m_CancelBtn.SetActive(ConfirmCancel.OnToggleConfirmEvent != null); |
| | | |
| | | // if (string.IsNullOrEmpty(ConfirmCancel.OKName)) |
| | | // (m_ConfirmBtn.FindComponent("Text", "Text") as Text).text = Language.Get("PopConfirmWin_OK"); |
| | | // else |
| | | // (m_ConfirmBtn.FindComponent("Text", "Text") as Text).text = ConfirmCancel.OKName; |
| | | // if (string.IsNullOrEmpty(ConfirmCancel.CancelName)) |
| | | // (m_CancelBtn.FindComponent("Text", "Text") as Text).text = Language.Get("PopConfirmWin_Cancel"); |
| | | // else |
| | | // (m_CancelBtn.FindComponent("Text", "Text") as Text).text = ConfirmCancel.CancelName; |
| | | } |
| | | |
| | | |
| | | private void OnConfirm() |
| | | { |
| | | CloseWindow(); |
| | | if (ConfirmCancel.OnToggleConfirmEvent != null) |
| | | { |
| | | ConfirmCancel.OnToggleConfirmEvent(true, m_Toggle.isOn); |
| | | } |
| | | } |
| | | |
| | | private void OnCancel() |
| | | { |
| | | CloseWindow(); |
| | | if (ConfirmCancel.OnToggleConfirmEvent != null) |
| | | { |
| | | ConfirmCancel.OnToggleConfirmEvent(false, m_Toggle.isOn); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 95ac88de84302544494ab3dac52375ef |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | (m_CancelBtn.FindComponent("Text", "Text") as Text).text = ConfirmCancel.CancelName; |
| | | } |
| | | |
| | | protected override void OnOpen() |
| | | { |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | } |
| | | |
| | | protected override void OnClose() |
| | | { |
| | | } |
| | | private void OnConfirm() |
| | | { |
| | | CloseWindow(); |
| | |
| | | default42, // 270 仙缘积分 |
| | | default43, // 271 幻境阁积分 |
| | | default44, // 272 武将招募积分 |
| | | default45, |
| | | default46, |
| | | default47, |
| | | default48, |
| | | default49, |
| | | default50, |
| | | GoldRush = 285, // 淘金令 |
| | | }; |
| | | |
| | | |
| | |
| | | public static readonly DateTime OriginalTime = new DateTime(1970, 1, 1, 8, 0, 0); |
| | | public static readonly DateTime ClientOriginalTime = new DateTime(1, 1, 1, 0, 0, 0); |
| | | /// <summary> |
| | | /// 服务器时间相比起始时间的秒数(主要方便比较) |
| | | /// 服务器时间相比起始时间的秒数(即服务器的时间戳) |
| | | /// </summary> |
| | | public static int AllSeconds |
| | | { |
| | |
| | | public static void SetIconWithMoneyType(this Image _image, int moneyType) |
| | | { |
| | | if (_image == null) return; |
| | | // string iconKey = StringUtility.Contact("Money_Type_", moneyType); |
| | | if (GeneralDefine.MoneyDisplayModel.ContainsKey(moneyType)) |
| | | { |
| | | _image.SetOrgSprite(ItemConfig.Get(GeneralDefine.MoneyDisplayModel[moneyType]).IconKey); |
| | | } |
| | | else |
| | | { |
| | | Debug.LogError("MoneyDisplayModel 为配置货币类型:" + moneyType); |
| | | // 不需要物品的情况补充 |
| | | // string iconKey = StringUtility.Contact("Money_Type_", moneyType); |
| | | Debug.LogError("MoneyDisplayModel 未配置货币类型:" + moneyType); |
| | | } |
| | | } |
| | | |
| | |
| | | //武将招募积分 |
| | | return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.default44); |
| | | } |
| | | case 52: |
| | | { |
| | | //淘金令 |
| | | return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.GoldRush); |
| | | } |
| | | case 98: |
| | | { |
| | | //过期型代金券 |
| | |
| | | return AppendColor(useCnt <= cnt ? engoughColor : TextColType.Red, $"{ReplaceLargeNum(cnt)}/{ReplaceLargeNum(useCnt)}"); |
| | | } |
| | | |
| | | |
| | | /// <param name="needTips">0 不响应 1 弹提示 2 弹获取途径tips</param> |
| | | public static bool CheckMoneyCount(int moneyType, long needCount, int needTips = 0) |
| | | { |
| | | if (needCount <= 0) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | long haveCount = GetMoneyCnt(moneyType); |
| | | |
| | | bool isEnough = haveCount >= needCount; |
| | | |
| | | if (!isEnough) |
| | | { |
| | | if (needTips == 1) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("LackMoney", moneyType); |
| | | } |
| | | else if (needTips == 2) |
| | | { |
| | | ItemTipUtility.ShowMoneyTip(moneyType); |
| | | } |
| | | } |
| | | |
| | | return isEnough; |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region 得到装备位或者祝福树品质名称 带颜色 |