Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_scripts
36个文件已修改
1个文件已删除
3个文件已添加
1 文件已重命名
| | |
| | | public const string BATTLE_DROP_ITEMS = "BATTLE_DROP_ITEMS";//掉落物品 |
| | | |
| | | public const string BATTLE_CAST_SKILL = "BATTLE_CAST_SKILL";//施放技能 |
| | | |
| | | public const string BATTLE_END = "BATTLE_END";//战斗结束 |
| | | } |
| | |
| | | |
| | | if (funcBtn != null) |
| | | { |
| | | funcBtn.interactable = IsOpen; |
| | | // 禁用按钮的点击事件,但不改变透明度 |
| | | funcBtn.enabled = IsOpen; |
| | | } |
| | | |
| | | |
| | |
| | | public bool customNegativeSound = false; |
| | | public int positiveSound = 0; |
| | | public int negativeSound = 0; |
| | | public float pressedScale = 1.1f; |
| | | |
| | | float m_AbleTime = 0f; |
| | | private Vector3 originalScale; |
| | | |
| | | public float ableTime { |
| | | get { return m_AbleTime; } |
| | | private set { |
| | |
| | | protected override void Awake() |
| | | { |
| | | base.Awake(); |
| | | originalScale = transform.localScale; |
| | | } |
| | | |
| | | public override void OnPointerDown(PointerEventData eventData) |
| | | { |
| | | base.OnPointerDown(eventData); |
| | | transform.localScale = originalScale * pressedScale; |
| | | } |
| | | |
| | | public override void OnPointerUp(PointerEventData eventData) |
| | | { |
| | | base.OnPointerUp(eventData); |
| | | transform.localScale = originalScale; |
| | | } |
| | | |
| | | private void PlayPositiveSound() |
| | |
| | | { |
| | | this.rectTransform.anchoredPosition = reversal ? from : to; |
| | | } |
| | | |
| | | base.OnOnceEnd(); |
| | | |
| | | } |
| | | |
| | | protected override void UpdateVector3() |
| | |
| | | |
| | | protected override void OnOnceEnd() |
| | | { |
| | | |
| | | if (wrapMode == WrapMode.PingPongOnce) |
| | | { |
| | | SetStartState(); |
| | | } |
| | | else |
| | | { |
| | | this.transform.localEulerAngles = reversal ? from : to; |
| | | } |
| | | base.OnOnceEnd(); |
| | | } |
| | | |
| | |
| | | |
| | | protected override void OnOnceEnd() |
| | | { |
| | | if (wrapMode == WrapMode.PingPongOnce) |
| | | { |
| | | SetStartState(); |
| | | } |
| | | else |
| | | { |
| | | this.transform.localScale = reversal ? from : to; |
| | | } |
| | | base.OnOnceEnd(); |
| | | } |
| | | |
| | |
| | | switch (wrapMode) |
| | | { |
| | | case WrapMode.Once: |
| | | if (accumulatedTime > duration) |
| | | { |
| | | OnOnceEnd(); |
| | | doTween = false; |
| | | } |
| | | break; |
| | | case WrapMode.PingPongOnce: |
| | | if (accumulatedTime > duration*2) |
| | | if (accumulatedTime > duration) |
| | | { |
| | | OnOnceEnd(); |
| | | doTween = false; |
| | |
| | | t = Mathf.Repeat((accumulatedTime / duration) * curveLength, 1); |
| | | break; |
| | | case WrapMode.PingPong: |
| | | case WrapMode.PingPongOnce: |
| | | t = Mathf.PingPong((accumulatedTime / duration) * curveLength, 1); |
| | | break; |
| | | case WrapMode.PingPongOnce: |
| | | t = Mathf.PingPong((accumulatedTime / (duration/2)) * curveLength, 1); |
| | | break; |
| | | } |
| | | |
| | | var value = curve.Evaluate(reversal ? curveLength - t : t); |
| | |
| | | } |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | public static int GetMaxAwakeLV(int heroID) |
| | | { |
| | | Dictionary<int, HeroAwakeConfig> tempDic = null; |
| | | if (!configDics.TryGetValue(heroID, out tempDic)) |
| | | { |
| | | return 0; |
| | | } |
| | | return tempDic.Count; |
| | | } |
| | | } |
| | |
| | | |
| | | public static int[] baseAttrs = new int[] { 6, 7, 8 }; |
| | | |
| | | // 映射对应的百分比属性,方便使用,如计算属性需要找对应的百分比加成 |
| | | public static Dictionary<int, int> baseAttr2perDict = new Dictionary<int, int>() |
| | | { |
| | | { 6,16 }, |
| | |
| | | { |
| | | Debug.LogError("战斗胜利"); |
| | | // 战斗胜利 |
| | | |
| | | // 如果是自动战斗转自动战斗? |
| | | } |
| | | else |
| | | { |
| | | // 战斗失败 |
| | | Debug.LogError("战斗失败"); |
| | | // HaveRest(); |
| | | } |
| | | |
| | | IsBattleFinish = true; |
| | | |
| | | |
| | | //提供外部 胜利等奖励显示 |
| | | EventBroadcast.Instance.Broadcast<string, JsonData>(EventName.BATTLE_END, guid, turnFightStateData); |
| | | |
| | | |
| | | }); |
| | | recordPlayer.PlayRecord(battleEndAction); |
| | | // 处理战斗结束逻辑 |
| | |
| | | public override void OnTurnFightState(int turnNum, int State, int FuncLineID, JsonData extendData) |
| | | { |
| | | base.OnTurnFightState(turnNum, State, FuncLineID, extendData); |
| | | |
| | | // 0-起始状态标记;1-准备完毕;2-战斗中;3-战斗结束;4-结算奖励;5-结束状态标记 6-休息并结束 |
| | | if (State == 4) |
| | | { |
| | | //上一波小怪死亡,默认帮玩家请求一下刷新新怪,玩家点击锤子时候就可以直接攻击 |
| | | RequestFight(); |
| | | } |
| | | } |
| | | |
| | | protected void OnTeamChange(TeamType teamType) |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | protected override void OnSettlement(JsonData turnFightStateData) |
| | | { |
| | | base.OnSettlement(turnFightStateData); |
| | | BattleManager.Instance.MainFightRequest(4); |
| | | } |
| | | |
| | | |
| | | public override void HaveRest() |
| | | { |
| | |
| | | // public override void OnBattleEnd(JsonData turnFightStateData) |
| | | // { |
| | | // base.OnBattleEnd(turnFightStateData); |
| | | |
| | | // // HaveRest(); |
| | | // } |
| | | |
| | |
| | | // 0-停止战斗回城 - 玩家主动点击回城时发送 |
| | | // 1-设置消耗倍值 - 玩家设置消耗倍值,对应到玩家useHarmerCount的值 |
| | | // 2-挑战关卡小怪 - 玩家点击开始战斗时发送,仅从休息状态到开始战斗时发送即可 |
| | | // 3-挑战关卡boss - 玩家请求挑战该关卡boss时发送 |
| | | // 3-重定义暂未使用 |
| | | // 4-继续战斗 - 玩家主线战斗中(包含主线小怪、主线boss),前端表现完后端同步的战斗片段后,可再回复该值,后端会根据战斗逻辑及流程自动回复下一段的战斗片段封包,一直循环 |
| | | public void MainFightRequest(byte reqType, uint reqValue = 0) |
| | | { |
| | |
| | | |
| | | public void PerformDrop() |
| | | { |
| | | if (null == battleDrops) |
| | | if (null == battleDrops || battleDrops.dropItemPackIndex.Count == 0) |
| | | return; |
| | | |
| | | EventBroadcast.Instance.Broadcast<string, BattleDrops, Action>( |
| | |
| | | using DG.Tweening; |
| | | using Spine; |
| | | using System.Linq; |
| | | using PlasticGui.WorkspaceWindow.BranchExplorer; |
| | | |
| | | |
| | | public class SkillBase |
| | |
| | | { |
| | | if (!string.IsNullOrEmpty(guid)) |
| | | return; |
| | | |
| | | lastDropIndexs = drops.dropItemPackIndex; |
| | | // Debug.Log("-掉落装备 " + lastDropIndexs.Count + " 个" + JsonMapper.ToJson(lastDropIndexs)); |
| | | NotifyItemDrop(drops.dropItemPackIndex, drops.rectTransform); |
| | | action?.Invoke(); |
| | | } |
| | |
| | | if (item == null) |
| | | return; |
| | | |
| | | |
| | | //非自动模式下,筛选装备打开装备操作界面 |
| | | if (IsEquip(item)) |
| | | { |
| | |
| | | if (info.MakeValue == 0) |
| | | return; |
| | | |
| | | if (info.MakeValue == 2) |
| | | waitEquipOPPack = false; |
| | | bool isDone = false; // 换上新装备且分解了旧装备 |
| | | //选中的地板装备进行处理,替换还是找下一件,检查OnEquipOPResultAction |
| | |
| | | /// <param name="autoDecompose"></param> |
| | | public void SendEquipOP(ushort[] itemIndexList, byte opType, bool autoDecompose = false) |
| | | { |
| | | if (waitEquipOPPack) return; |
| | | if (opType == 2 && waitEquipOPPack) return; |
| | | |
| | | // NoteFloorEquip(itemIndexList, opType); |
| | | var pack = new CB415_tagCSMainDropItemOP(); |
| | |
| | | pack.OPType = opType; |
| | | pack.OPValue = (byte)(autoDecompose ? 1 : 0); // 替换后是否自动分解原装备:0否1是 |
| | | |
| | | if (opType > 0) |
| | | if (opType == 2) |
| | | waitEquipOPPack = true; |
| | | GameNetSystem.Instance.SendInfo(pack); |
| | | } |
| | |
| | | return freeCountToday < funcSet.DailyFreeCount;
|
| | | }
|
| | |
|
| | |
|
| | | public int GetFreeCountToday(int type)
|
| | | {
|
| | | XBTypeInfo typeInfo = GetXBInfoByType(type);
|
| | | if (typeInfo != null)
|
| | | {
|
| | | return typeInfo.freeCountToday;
|
| | | }
|
| | | |
| | | return 0;
|
| | | }
|
| | |
|
| | | public int GetDailyFreeCount(int type)
|
| | | {
|
| | | return TreasureSetConfig.Get(type).DailyFreeCount;
|
| | | }
|
| | |
|
| | | //获取还需多少次可得幸运奖励
|
| | | public int GetNextXBCountForBigAward(int type, out List<int> qualityList)
|
| | | {
|
| | |
| | | call1ItemIcon.SetOrgSprite(IconKey); |
| | | var itemCount = PackManager.Instance.GetItemCountByID(PackType.Item, funcSet.CostItemID); |
| | | |
| | | if (HappyXBModel.Instance.IsHaveFreeXB((int)HeroUIManager.Instance.selectCallType)) |
| | | int todayFreeCount = HappyXBModel.Instance.GetFreeCountToday((int)HeroUIManager.Instance.selectCallType); |
| | | int dayMaxCount = HappyXBModel.Instance.GetDailyFreeCount((int)HeroUIManager.Instance.selectCallType); |
| | | if (todayFreeCount < dayMaxCount) |
| | | { |
| | | call1Text.text = Language.Get("L1127"); |
| | | call1Text.text = Language.Get("L1127") + (dayMaxCount - todayFreeCount) + "/" + dayMaxCount; |
| | | } |
| | | else |
| | | { |
| | |
| | | call1ItemIcon.SetOrgSprite(IconKey); |
| | | call10ItemIcon.SetOrgSprite(IconKey); |
| | | var itemCount = PackManager.Instance.GetItemCountByID(PackType.Item, funcSet.CostItemID); |
| | | if (HappyXBModel.Instance.IsHaveFreeXB((int)HappXBTitle.HeroCallAdvanced)) |
| | | |
| | | int todayFreeCount = HappyXBModel.Instance.GetFreeCountToday((int)HappXBTitle.HeroCallAdvanced); |
| | | int dayMaxCount = HappyXBModel.Instance.GetDailyFreeCount((int)HappXBTitle.HeroCallAdvanced); |
| | | if (todayFreeCount < dayMaxCount) |
| | | { |
| | | call1Text.text = Language.Get("L1127"); |
| | | call1Text.text = Language.Get("L1127") + (dayMaxCount - todayFreeCount) + "/" + dayMaxCount; |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | // 75 # 英雄天赋洗炼锁定索引列表,对应71天赋ID索引 |
| | | public List<int> talentLockList |
| | | { |
| | | get |
| | | { |
| | | if (itemHero == null) |
| | | return null; |
| | | return itemHero.GetUseData(75); |
| | | } |
| | | } |
| | | |
| | | |
| | | Dictionary<int, int> talentAttrDic = new Dictionary<int, int>(); //属性ID : 天赋属性值 |
| | | |
| | |
| | | return 0; |
| | | } |
| | | |
| | | public int GetMaxStarCount() |
| | | { |
| | | if (Quality < 4) |
| | | return HeroUIManager.normalGiftMaxCnt * HeroUIManager.Instance.maxGiftLevel; |
| | | return HeroUIManager.giftMaxCnt * HeroUIManager.Instance.maxGiftLevel; |
| | | } |
| | | |
| | | public int GetTotalStarCount() |
| | | { |
| | | //talentLvList里的元素全部相加 |
| | | return talentLvList.Sum(); |
| | | } |
| | | |
| | | //天赋会更快到达满级;觉醒可以提升星上限,如初始时40满星,觉醒X级后50满星 |
| | | //判断当前是否满星 |
| | | public bool IsFullStar() |
| | | { |
| | | if (HeroAwakeConfig.GetHeroAwakeConfig(heroId, 1) == null) |
| | | { |
| | | return heroStar >= HeroQualityConfig.Get(Quality).InitStarUpper; |
| | | } |
| | | |
| | | //根据觉醒累计提升星上限 |
| | | int addStarCount = 0; |
| | | for (int i = 1; i <= awakeLevel; i++) |
| | | { |
| | | addStarCount += HeroAwakeConfig.GetHeroAwakeConfig(heroId, i).AddStarUpper; |
| | | } |
| | | return heroStar >= HeroQualityConfig.Get(Quality).InitStarUpper + addStarCount; |
| | | } |
| | | |
| | | public bool IsFullGift() |
| | | { |
| | | //检查talentLvList 所有元素都大于等于10 |
| | | return talentLvList.All(x => x >= HeroUIManager.Instance.maxGiftLevel); |
| | | } |
| | | |
| | | |
| | | |
| | | public int GetTalentLockCount() |
| | | { |
| | | //talentLockList里的元素全部相加 1代表锁定 0代表未锁定 |
| | | return talentLockList.Sum(); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | //showState 0:不显示 1:新增 2:提升 |
| | | //giftID 0 :代表灰色需升星激活 -1:代表棕色需觉醒激活,其他根据配表,没有天赋的外层控制显隐 |
| | | public void Init(int giftID, int lv, UnityAction onclick = null, int showState = 0) |
| | | public void Init(int giftID, int lv, UnityAction onclick = null, int showState = 0, int heroID = 0, int index = 0) |
| | | { |
| | | giftBtn.AddListener(onclick); |
| | | if (HeroTalentConfig.HasKey(giftID)) |
| | | { |
| | | var config = HeroTalentConfig.Get(giftID); |
| | |
| | | lvRect.SetActive(false); |
| | | stateImg.SetActive(false); |
| | | } |
| | | giftBtn.AddListener(onclick != null ? onclick : () => { ShowSmallTip(giftID, lv, heroID, index); }); |
| | | } |
| | | |
| | | void ShowSmallTip(int giftID, int giftLV, int heroID, int index) |
| | | { |
| | | SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition); |
| | | if (giftID > 0) |
| | | { |
| | | var giftConfig = HeroTalentConfig.Get(giftID); |
| | | SmallTipWin.showText = Language.Get("SmallTipFomat", giftConfig.Name + " " + Language.Get("L1113", giftLV), |
| | | Language.Get("HeroGift5", PlayerPropertyConfig.Get(giftConfig.AttrID).Name, PlayerPropertyConfig.GetValueDescription(giftConfig.AttrID, giftConfig.AttrValue))); |
| | | UIManager.Instance.OpenWindow<SmallTipWin>(); |
| | | |
| | | } |
| | | else if (giftID == 0) |
| | | { |
| | | SmallTipWin.showText = Language.Get("HeroGift1"); |
| | | UIManager.Instance.OpenWindow<SmallTipWin>(); |
| | | } |
| | | else if (giftID == -1) |
| | | { |
| | | SmallTipWin.showText = Language.Get("HeroGift2", HeroAwakeConfig.GetAwakeLVByUnLockGiftIndex(heroID, index)); |
| | | UIManager.Instance.OpenWindow<SmallTipWin>(); |
| | | } |
| | | } |
| | | |
| | | |
| | | Color32 GetColor(int quality) |
| | | { |
| | |
| | | |
| | | } |
| | | scale = width / rect.sizeDelta.x; |
| | | cellContainer.transform.localScale = new Vector3(scale, scale, scale); |
| | | cellContainer.transform.localScale = cellContainer.transform.localScale * scale; |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | |
| | | /// <summary> |
| | | /// 武将吞噬界面 |
| | | /// </summary> |
| | | public class HeroGiftEatWin : UIBase |
| | | { |
| | | [SerializeField] HeroShowBaseCell heroShow; |
| | | [SerializeField] GiftBaseCell[] giftCells; |
| | | [SerializeField] Button addHeroBtn; |
| | | [SerializeField] GameObject addHeroGo; |
| | | [SerializeField] HeroShowBaseCell addHeroShow; |
| | | [SerializeField] GiftBaseCell[] addGiftCells; |
| | | [SerializeField] GameObject addTip; |
| | | [SerializeField] GameObject addAttrGo; |
| | | [SerializeField] Text[] addAttrTexts; |
| | | [SerializeField] Text addGiftTip; |
| | | |
| | | [SerializeField] GameObject eatBtn; |
| | | |
| | | |
| | | |
| | | string addHeroGuid; |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | var hero = HeroManager.Instance.GetHero(HeroUIManager.Instance.selectHeroGuidForGiftFunc); |
| | | Display(hero); |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | addHeroGuid = ""; |
| | | } |
| | | |
| | | |
| | | public void Display(HeroInfo hero) |
| | | { |
| | | heroShow.Init(hero.heroId, hero.SkinID, hero.breakLevel, hero.heroStar, hero.awakeLevel, hero.heroLevel); |
| | | HeroUIManager.Instance.RefreshGiftCell(giftCells, hero); |
| | | if (string.IsNullOrEmpty(addHeroGuid)) |
| | | { |
| | | addHeroBtn.SetActive(true); |
| | | addHeroGo.SetActive(false); |
| | | addTip.SetActive(true); |
| | | addAttrGo.SetActive(false); |
| | | } |
| | | else |
| | | { |
| | | addHeroBtn.SetActive(false); |
| | | addHeroGo.SetActive(true); |
| | | addTip.SetActive(false); |
| | | addAttrGo.SetActive(true); |
| | | var addHero = HeroManager.Instance.GetHero(addHeroGuid); |
| | | addHeroShow.Init(addHero.heroId, addHero.SkinID, addHero.breakLevel, addHero.heroStar, addHero.awakeLevel, addHero.heroLevel); |
| | | HeroUIManager.Instance.RefreshGiftCell(addGiftCells, addHero); |
| | | for (int i = 0; i < addAttrTexts.Length; i++) |
| | | { |
| | | int id = PlayerPropertyConfig.baseAttrs[i]; |
| | | addAttrTexts[i].text = PlayerPropertyConfig.GetFullDescription(id, hero.qualityConfig.StarAddPer); |
| | | } |
| | | addGiftTip.SetActive(hero.IsFullGift()); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 93b6b3386d485e34580130c8aff973bb |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | var giftID = configList[index]; |
| | | var giftLV = HeroUIManager.Instance.maxGiftLevel; |
| | | cardList[i].SetActive(true); |
| | | cardList[i].Init(giftID, giftLV, () => |
| | | { |
| | | var giftConfig = HeroTalentConfig.Get(giftID); |
| | | SmallTipWin.showText = Language.Get("SmallTipFomat", giftConfig.Name + " " + Language.Get("L1113", giftLV), |
| | | Language.Get("HeroGift5", PlayerPropertyConfig.Get(giftConfig.AttrID).Name, PlayerPropertyConfig.GetValueDescription(giftConfig.AttrID, giftConfig.AttrValue))); |
| | | SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition); |
| | | UIManager.Instance.OpenWindow<SmallTipWin>(); |
| | | }); |
| | | cardList[i].Init(giftID, giftLV); |
| | | } |
| | | else |
| | | { |
| | |
| | | |
| | | } |
| | | scale = width / rect.sizeDelta.x; |
| | | cellContainer.transform.localScale = new Vector3(scale, scale, scale); |
| | | cellContainer.transform.localScale = cellContainer.transform.localScale * scale; |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | string guid; |
| | | HeroInfo hero; |
| | | |
| | | |
| | | protected override void InitComponent() |
| | |
| | | guid = HeroUIManager.Instance.waitResponse.guid; |
| | | if (string.IsNullOrEmpty(guid)) |
| | | return; |
| | | hero = HeroManager.Instance.GetHero(guid); |
| | | Refresh(); |
| | | Display(HeroManager.Instance.GetHero(guid)); |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | |
| | | } |
| | | |
| | | |
| | | public override void Refresh() |
| | | public void Display(HeroInfo hero) |
| | | { |
| | | breakLVText.text = "+" + (hero.breakLevel - 1); |
| | | nextBreakLVText.text = "+" + hero.breakLevel; |
| | |
| | | void RefreshPackCount() |
| | | { |
| | | int count = singlePack.GetAllItems().Count; |
| | | heroPackText.text = UIHelper.AppendColor(count > singlePack.unlockedGridCount ? TextColType.Red : TextColType.NavyBrown, |
| | | heroPackText.text = UIHelper.AppendColor(count >= singlePack.unlockedGridCount ? TextColType.Red : TextColType.NavyBrown, |
| | | string.Format("{0}/{1}", count, singlePack.unlockedGridCount)); |
| | | |
| | | } |
| | |
| | | using UnityEngine.UI; |
| | | using System.Collections.Generic; |
| | | |
| | | //武将模型站台模块 |
| | | public class HeroShowBaseCell : MonoBehaviour |
| | | { |
| | | |
| | | Image m_QualityBG; |
| | | Image qualityBG |
| | | Image qualityBG //底座台子 |
| | | { |
| | | get |
| | | { |
| | |
| | | { |
| | | if (m_StarRect == null) |
| | | { |
| | | m_StarRect = this.transform.Find("Container_HeroShow/stars"); |
| | | m_StarRect = this.transform.Find("Container_HeroShow/layout/stars"); |
| | | } |
| | | return m_StarRect; |
| | | } |
| | |
| | | m_StarsImg = new List<Image>(); |
| | | for (int i = 0; i < 5; i++) |
| | | { |
| | | var star = this.transform.GetComponent<Image>("Container_HeroShow/stars/star" + i); |
| | | var star = this.transform.GetComponent<Image>("Container_HeroShow/layout/stars/star" + i); |
| | | m_StarsImg.Add(star); |
| | | } |
| | | } |
| | |
| | | { |
| | | if (m_LvText == null) |
| | | { |
| | | m_LvText = this.transform.GetComponent<Text>("Container_HeroShow/lv"); |
| | | m_LvText = this.transform.GetComponent<Text>("Container_HeroShow/layout/lv"); |
| | | } |
| | | return m_LvText; |
| | | } |
| | | } |
| | | |
| | | |
| | | OutlineEx heroNameOutline; |
| | | OutlineEx heroLVOutline; |
| | | OutlineEx m_LvTextOutline; |
| | | OutlineEx heroLVOutline |
| | | { |
| | | get |
| | | { |
| | | if (m_LvTextOutline == null) |
| | | { |
| | | m_LvTextOutline = this.transform.GetComponent<OutlineEx>("Container_HeroShow/layout/lv"); |
| | | } |
| | | return m_LvTextOutline; |
| | | } |
| | | } |
| | | void Awake() |
| | | { |
| | | LoadPrefab(); |
| | | } |
| | | |
| | | // 武将小头像,(职业和名称不再此管理,各个界面排版不同) |
| | | public void Init(int heroID, int skinID = 0, int breakLevel = 0, int star = 0, int awakelv = 0, int lv = 0, bool isShowLock = false) |
| | | // 武将模型站台显示 |
| | | public void Init(int heroID, int skinID, int breakLevel = 0, int star = 0, int awakelv = 0, int lv = 0, bool isShowLock = false) |
| | | { |
| | | var heroConfig = HeroConfig.Get(heroID); |
| | | qualityBG.SetSprite("herodz" + heroConfig.Quality); |
| | |
| | | |
| | | nameText.text = breakLevel == 0 ? heroConfig.Name : Language.Get("herocardbreaklv", heroConfig.Name, breakLevel); |
| | | nameText.color = UIHelper.GetUIColorByFunc(heroConfig.Quality); |
| | | heroNameOutline.colorType = (QualityTextColType)heroConfig.Quality; |
| | | lvText.text = string.Format("{0}{1} {2}", Language.Get("L1094"), lv, awakelv == 0 ? Language.Get("herocard13") : Language.Get("herocard12", awakelv)); |
| | | heroLVOutline.colorType = awakelv == 0 ? QualityTextColType.None : QualityTextColType.red; |
| | | |
| | |
| | | |
| | | } |
| | | scale = width / rect.sizeDelta.x; |
| | | cellContainer.transform.localScale = new Vector3(scale, scale, scale); |
| | | heroNameOutline = nameText.GetComponent<OutlineEx>(); |
| | | heroLVOutline = lvText.GetComponent<OutlineEx>(); |
| | | cellContainer.transform.localScale = cellContainer.transform.localScale * scale; |
| | | } |
| | | } |
| | | |
| | |
| | | }); |
| | | |
| | | starUPBtn.AddListener(StarUP); |
| | | washBtn.AddListener(Wash); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | void RefreshGift() |
| | | { |
| | | RefreshGiftCell(); |
| | | HeroUIManager.Instance.RefreshGiftCell(giftBaseCells, hero); |
| | | |
| | | if (hero.GetTotalStarCount() >= hero.GetMaxStarCount()) |
| | | if (hero.heroStar >= HeroUIManager.Instance.GetMaxStarCount(hero.heroId, hero.Quality)) |
| | | { |
| | | starUPBtn.interactable = false; |
| | | starUPBtn.SetColorful(null, false); |
| | |
| | | starUPBtn.SetColorful(null, true); |
| | | starUPBtnText.text = Language.Get("HeroGift3"); |
| | | } |
| | | } |
| | | |
| | | void RefreshGiftCell() |
| | | if (hero.heroStar < HeroUIManager.Instance.canWashStarLevel) |
| | | { |
| | | //传说以下只有4个 |
| | | int showCount = hero.Quality < 4 ? HeroUIManager.normalGiftMaxCnt : HeroUIManager.giftMaxCnt; |
| | | for (int i = 0; i < giftBaseCells.Length; i++) |
| | | { |
| | | if (i >= showCount) |
| | | { |
| | | giftBaseCells[i].SetActive(false); |
| | | continue; |
| | | } |
| | | |
| | | giftBaseCells[i].SetActive(true); |
| | | if (i < hero.talentIDList.Count) |
| | | { |
| | | int giftID = hero.talentIDList[i]; |
| | | int giftLV = hero.talentLvList[i]; |
| | | giftBaseCells[i].Init(giftID, giftLV, () => |
| | | { |
| | | var giftConfig = HeroTalentConfig.Get(giftID); |
| | | SmallTipWin.showText = Language.Get("SmallTipFomat", giftConfig.Name + " " + Language.Get("L1113", giftLV), |
| | | Language.Get("HeroGift5", PlayerPropertyConfig.Get(giftConfig.AttrID).Name, PlayerPropertyConfig.GetValueDescription(giftConfig.AttrID, giftConfig.AttrValue))); |
| | | SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition); |
| | | UIManager.Instance.OpenWindow<SmallTipWin>(); |
| | | }); |
| | | washBtn.SetColorful(washBtn.GetComponentInChildren<Text>(), false); |
| | | } |
| | | else |
| | | { |
| | | if (i < HeroUIManager.normalGiftMaxCnt) |
| | | { |
| | | giftBaseCells[i].Init(0, 0, () => |
| | | { |
| | | SmallTipWin.showText = Language.Get("HeroGift1"); |
| | | SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition); |
| | | UIManager.Instance.OpenWindow<SmallTipWin>(); |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | int index = i; |
| | | giftBaseCells[i].Init(-1, 0, () => |
| | | { |
| | | SmallTipWin.showText = Language.Get("HeroGift2", HeroAwakeConfig.GetAwakeLVByUnLockGiftIndex(hero.heroId, index)); |
| | | SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition); |
| | | UIManager.Instance.OpenWindow<SmallTipWin>(); |
| | | }); |
| | | washBtn.SetColorful(washBtn.GetComponentInChildren<Text>(), true); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | void StarUP() |
| | | { |
| | | if (hero.GetTotalStarCount() >= hero.GetMaxStarCount()) |
| | | if (hero.heroStar >= HeroUIManager.Instance.GetMaxStarCount(hero.heroId, hero.Quality)) |
| | | { |
| | | return; |
| | | } |
| | |
| | | { |
| | | starUPBtn.interactable = true; |
| | | starUPBtn.SetColorful(null, true); |
| | | starUPBtnText.text = Language.Get("HeroGift3"); |
| | | HeroUIManager.Instance.selectHeroGuidForGiftFunc = hero.itemHero.guid; |
| | | UIManager.Instance.OpenWindow<HeroGiftEatWin>(); |
| | | } |
| | | } |
| | | |
| | | void Wash() |
| | | { |
| | | if (hero.heroStar < HeroUIManager.Instance.canWashStarLevel) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("HeroGift2", HeroUIManager.Instance.canWashStarLevel); |
| | | return; |
| | | } |
| | | // //根据锁状态判断材料是否足够 |
| | | // if (!ItemLogicUtility.CheckItemCount(PackType.Item, HeroUIManager.Instance.washItemID, |
| | | // HeroUIManager.Instance.GetTalentLockUseWashCount(hero), 2)) |
| | | // { |
| | | // return; |
| | | // } |
| | | |
| | | |
| | | // UIManager.Instance.OpenWindow<HeroGiftWashWin>(); |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using LitJson; |
| | | |
| | | using UnityEngine; |
| | | |
| | | //天赋 |
| | | public partial class HeroUIManager : GameSystemManager<HeroUIManager> |
| | | { |
| | | public int normalGiftMaxCnt = 4; //初始天赋格子数 |
| | | public const int giftMaxCnt = 8; //关联界面排版问题,暂时写死,通过觉醒可以增加上限 |
| | | public int maxGiftLevel; //单天赋最高等级,其他功能可能会增加这个上限 |
| | | public int starLevelCanAwake; //x星可以觉醒 |
| | | |
| | | public int washItemID; |
| | | public int[] washByLockUseCounts; |
| | | public int canWashStarLevel; //达到X星可以洗练 |
| | | |
| | | public string selectHeroGuidForGiftFunc; |
| | | |
| | | void ParseGiftConfig() |
| | | { |
| | | var config = FuncConfigConfig.Get("HeroStarTalent"); |
| | | normalGiftMaxCnt = int.Parse(config.Numerical1); |
| | | maxGiftLevel = int.Parse(config.Numerical2); |
| | | starLevelCanAwake = int.Parse(config.Numerical4); |
| | | |
| | | config = FuncConfigConfig.Get("HeroWash"); |
| | | washItemID = int.Parse(config.Numerical1); |
| | | washByLockUseCounts = JsonMapper.ToObject<int[]>(config.Numerical2); |
| | | canWashStarLevel = int.Parse(config.Numerical3); |
| | | } |
| | | |
| | | |
| | | //根据天赋锁状态获取消耗的材料数量 |
| | | public int GetTalentLockUseWashCount(HeroInfo hero) |
| | | { |
| | | return washByLockUseCounts[hero.GetTalentLockCount()]; |
| | | } |
| | | |
| | | |
| | | //天赋格子总数上限 |
| | | public int GetGiftGirdMaxCount(int heroID) |
| | | { |
| | | //没有觉醒配置的 为默认4,否则8 |
| | | if (HeroAwakeConfig.GetHeroAwakeConfig(heroID, 1) == null) |
| | | { |
| | | return Instance.normalGiftMaxCnt; |
| | | } |
| | | return giftMaxCnt; |
| | | } |
| | | |
| | | |
| | | |
| | | //星上限由品质 和 觉醒决定 |
| | | public int GetMaxStarCount(int heroID, int quality) |
| | | { |
| | | if (HeroAwakeConfig.GetHeroAwakeConfig(heroID, 1) == null) |
| | | { |
| | | return HeroQualityConfig.Get(quality).InitStarUpper; |
| | | |
| | | } |
| | | |
| | | //根据觉醒累计提升星上限 |
| | | int addStarCount = 0; |
| | | for (int i = 1; i <= HeroAwakeConfig.GetMaxAwakeLV(heroID); i++) |
| | | { |
| | | addStarCount += HeroAwakeConfig.GetHeroAwakeConfig(heroID, i).AddStarUpper; |
| | | } |
| | | return HeroQualityConfig.Get(quality).InitStarUpper + addStarCount; |
| | | } |
| | | |
| | | |
| | | public void RefreshGiftCell(GiftBaseCell[] giftBaseCells, HeroInfo hero) |
| | | { |
| | | int showCount = GetGiftGirdMaxCount(hero.heroId); |
| | | for (int i = 0; i < giftBaseCells.Length; i++) |
| | | { |
| | | if (i >= showCount) |
| | | { |
| | | giftBaseCells[i].SetActive(false); |
| | | continue; |
| | | } |
| | | |
| | | giftBaseCells[i].SetActive(true); |
| | | if (i < hero.talentIDList.Count) |
| | | { |
| | | int giftID = hero.talentIDList[i]; |
| | | int giftLV = hero.talentLvList[i]; |
| | | giftBaseCells[i].Init(giftID, giftLV); |
| | | } |
| | | else |
| | | { |
| | | if (i < normalGiftMaxCnt) |
| | | { |
| | | giftBaseCells[i].Init(0, 0); |
| | | } |
| | | else |
| | | { |
| | | int index = i; |
| | | giftBaseCells[i].Init(-1, 0, null, hero.heroId, index); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | { |
| | | if (itemID == 0) |
| | | { |
| | | Debug.LogError("itemID == 0"); |
| | | // Debug.LogError("itemID == 0"); |
| | | return; |
| | | } |
| | | numText.text = UIHelper.ReplaceLargeNum(PackManager.Instance.GetItemCountByID(PackType.Item, itemID)); |
| | |
| | | { |
| | | if (moneyType == 0) |
| | | { |
| | | Debug.LogError("moneyType == 0"); |
| | | // Debug.LogError("moneyType == 0"); |
| | | return; |
| | | } |
| | | numText.text = UIHelper.ReplaceLargeNum(UIHelper.GetMoneyCnt(moneyType)); |
| | |
| | | } |
| | | |
| | | //自动模式, 真正点击战锤消耗开启,和休息(或无材料)停止 |
| | | public bool isAutoAttack = false; |
| | | bool m_IsAutoAttack = false; |
| | | public bool isAutoAttack |
| | | { |
| | | get |
| | | { |
| | | return m_IsAutoAttack; |
| | | } |
| | | set |
| | | { |
| | | if (m_IsAutoAttack == value) |
| | | return; |
| | | m_IsAutoAttack = value; |
| | | Debug.Log("isAutoAttack:" + m_IsAutoAttack); |
| | | } |
| | | } |
| | | |
| | | //是否开启自动战斗设置 |
| | | public bool isAutoAttackSet |
| | |
| | | ParseConfig(); |
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += BeforePlayerInit; |
| | | BattleManager.Instance.onBattleFieldCreate += OnCreateBattleField; |
| | | |
| | | EventBroadcast.Instance.AddListener<string, SkillConfig, TeamHero>(EventName.BATTLE_CAST_SKILL, OnSkillCast); |
| | | |
| | | } |
| | |
| | | { |
| | | BattleManager.Instance.onBattleFieldCreate -= OnCreateBattleField; |
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent -= BeforePlayerInit; |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | if (storyBattleField != null && storyBattleField.GetBattleMode() != BattleMode.Stop) |
| | | { |
| | | //战斗中改变模式 |
| | | isAutoAttack = isAutoAttackSet; |
| | | storyBattleField.AutoSetBattleMode(); |
| | | } |
| | | |
| | |
| | | return; |
| | | } |
| | | |
| | | if (isAutoAttackSet) |
| | | { |
| | | isAutoAttack = true; |
| | | } |
| | | |
| | | isAutoAttack = isAutoAttackSet; |
| | | |
| | | //手动会一直进入这个逻辑, 自动触发一次 |
| | | storyBattleField.AutoSetBattleMode(); |
| | |
| | | if (!string.IsNullOrEmpty(guid)) |
| | | return; |
| | | |
| | | //防范回收报错 |
| | | if (teamHero == null) |
| | | return; |
| | | |
| | | //只通知玩家武将的战斗 |
| | | if (teamHero.NPCID != 0) |
| | | return; |
| | |
| | | if (isOK) |
| | | { |
| | | AutoFightModel.Instance.isAutoAttackSet = false; |
| | | AutoFightModel.Instance.isAutoAttack = false; |
| | | AutoFightModel.Instance.fightCost = int.Parse(costText.text); |
| | | AutoFightModel.Instance.fightSpeed = int.Parse(speedText.text); |
| | | AutoFightModel.Instance.isStopFightByBetterEquip = betterEquipToggle.isOn; |
| | |
| | | [SerializeField] Image restImg; //休息状态 |
| | | [SerializeField] GameObject fightGo; //战斗状态 |
| | | [SerializeField] Image fightHeroImg; //战斗显示英雄 |
| | | [SerializeField] ScaleTween fightHeroScale; //战斗显示英雄缩放 |
| | | [SerializeField] UIEffectPlayer fightEffect; |
| | | [SerializeField] FillTween cdTween; |
| | | |
| | |
| | | AutoFightModel.Instance.fightingHeroSkinID = TeamManager.Instance.GetTeam(TeamType.Story).GetNextServerHero(AutoFightModel.Instance.heroGuid).SkinID; |
| | | fightHeroImg.SetOrgSprite(HeroSkinConfig.Get(AutoFightModel.Instance.fightingHeroSkinID).SquareIcon, "HeroHead"); |
| | | }); |
| | | fightHeroScale.SetStartState(); |
| | | fightHeroScale.Play(); |
| | | } |
| | | else |
| | | { |
| | | fightEffect.Stop(); |
| | | cdTween.Stop(); |
| | | cdTween.SetEndState(); |
| | | fightHeroScale.Stop(); |
| | | } |
| | | |
| | | if (AutoFightModel.Instance.fightingHeroSkinID == 0) |
| | |
| | | quickSettingDic.Add(QuickSettingType.AutoFight_Open, new QuickSettingRange(QuickSettingType.AutoFight_Open, 3, 1)); |
| | | setting = new string(UCharacter, 100); |
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += BeforePlayerDataInitializeEvent; |
| | | DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent += OnPlayerLoginOk; |
| | | } |
| | | |
| | | public Dictionary<QuickSettingType, QuickSettingRange> quickSettingDic = new Dictionary<QuickSettingType, QuickSettingRange>(); |
| | |
| | | PlayerDatas.Instance.baseData.Setting = setting; |
| | | } |
| | | |
| | | private void OnPlayerLoginOk() |
| | | { |
| | | //初始设置 |
| | | if (PlayerDatas.Instance.baseData.LV == 1 && !AutoFightModel.Instance.isStopFightByBetterEquip) |
| | | { |
| | | AutoFightModel.Instance.isStopFightByBetterEquip = true; |
| | | AutoFightModel.Instance.SaveAutoFightSetting(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | public enum QuickSettingType |
| | |
| | | |
| | | } |
| | | scale = width / rect.sizeDelta.x; |
| | | cellContainer.transform.localScale = new Vector3(scale, scale, scale); |
| | | cellContainer.transform.localScale = cellContainer.transform.localScale * scale; |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | } |
| | | scale = width / rect.sizeDelta.x; |
| | | cellContainer.transform.localScale = new Vector3(scale, scale, scale); |
| | | cellContainer.transform.localScale = cellContainer.transform.localScale * scale; |
| | | } |
| | | } |
| | | |
| | |
| | | _btnTxt.color = UIHelper.GetUIColor(_colorful ? TextColType.Green : TextColType.White); |
| | | break; |
| | | default: |
| | | _btnTxt.color = UIHelper.GetUIColor(_colorful ? TextColType.NavyBrown : TextColType.White); |
| | | //false 灰色,true 原色 |
| | | if (!_colorful) |
| | | _btnTxt.text = UIHelper.AppendColor(TextColType.NavyGray, _btnTxt.text); //不改变组件颜色,只改变显示颜色 |
| | | else |
| | | _btnTxt.text = UIHelper.AppendColor(_btnTxt.color, _btnTxt.text); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | public static void SetInteractable(this Button _btn, Text _btnText, bool _interactable) |
| | | // 设置按钮是否可点击,且置灰,默认取第一个文本;图片需用ImageEx组件 |
| | | // 更多功能请使用SetColorful |
| | | public static void SetInteractable(this Button _btn, bool _interactable, Text _btnText = null) |
| | | { |
| | | if (_btn != null) |
| | | { |
| | |
| | | imageEx.gray = !_interactable; |
| | | } |
| | | } |
| | | if (_btnText == null) |
| | | _btnText = _btn.GetComponentInChildren<Text>(); |
| | | if (_btnText != null) |
| | | { |
| | | _btnText.color = UIHelper.GetUIColor(_interactable ? TextColType.NavyBrown : TextColType.White); |
| | | //_btnText.color = _btnText.color.SetA(_interactable ? 1 : 0.5f); |
| | | //false 灰色,true 原色 |
| | | if (!_interactable) |
| | | _btnText.text = UIHelper.AppendColor(TextColType.NavyGray, _btnText.text); //不改变组件颜色,只改变显示颜色 |
| | | else |
| | | _btnText.text = UIHelper.AppendColor(_btnText.color, _btnText.text); |
| | | } |
| | | } |
| | | |
| | |
| | | return msg; |
| | | } |
| | | |
| | | public static string AppendColor(Color color, string msg) |
| | | { |
| | | return StringUtility.Contact("<color=#", ColorToHexWithHash(color), ">", msg, "</color>"); |
| | | } |
| | | |
| | | |
| | | public static string ColorToHexWithHash(Color color, bool includeAlpha = false) |
| | | { |
| | | int r = Mathf.RoundToInt(color.r * 255); |
| | | int g = Mathf.RoundToInt(color.g * 255); |
| | | int b = Mathf.RoundToInt(color.b * 255); |
| | | if (includeAlpha) |
| | | { |
| | | int a = Mathf.RoundToInt(color.a * 255); |
| | | return string.Format("{0:X2}{1:X2}{2:X2}{3:X2}", r, g, b, a); |
| | | } |
| | | else |
| | | { |
| | | return string.Format("{0:X2}{1:X2}{2:X2}", r, g, b); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | //needName 指官职0是否需要名称 |
| | | public static string GetRealmName(int realmLv, bool bright = true, bool needName = false) |
| | | { |
| | |
| | | /// <param name="itemColor"></param> |
| | | /// <param name="msg"></param> |
| | | /// <param name="bright"></param> |
| | | /// <param name="colorGroupType"></param> |
| | | /// <param name="colorGroupType">0 通用功能品质分组精良到神话</param> |
| | | /// <returns></returns> |
| | | public static string AppendColor(int itemColor, string msg, bool bright = true, int colorGroupType = 0) |
| | | { |