private void Awake() { defaultGunData = TableMgr.singleton.GunCardTable.GetItemByID(TableMgr.singleton.ValueTable.init_weapon_id); //m_WeaponNode = transform.Find("ModelNode/hero/weapon_bip"); m_Anim = transform.Find("ModelNode/hero").GetComponent <Animator>(); m_UITrans = transform.Find("TaskNode"); }
public override void Init <T>(string name, UIInfo info, T arg) { base.Init(name, info, arg); optCardRes = arg as GunCard_TableItem; if (optCardRes == null) { return; } var cardData = PlayerDataMgr.singleton.GetGunCardData(optCardRes.id); if (cardData == null) { return; } ResetCost.text.text = TableMgr.singleton.ValueTable.card_reset_cost.ToString(); BigInteger gold = 0; for (int i = 2; i <= cardData.level; ++i) { gold += PlayerDataMgr.singleton.GetCardLvUpCost(i); } GetGold.text.text = gold.ToSymbolString(); }
public void Init(GunCard_TableItem res) { TipsTitle.text.text = LanguageMgr.GetText(res.tid_name); IconBtn.image.sprite = Resources.Load(res.icon, typeof(Sprite)) as Sprite; Frame.image.sprite = Resources.Load(TableMgr.singleton.ValueTable.GetCardQualityFrame(res.rarity), typeof(Sprite)) as Sprite; //根据品质设置亮边 }
public override void Init <T>(string name, UIInfo info, T arg) { base.Init(name, info, arg); gunCardRes = arg as GunCard_TableItem; if (gunCardRes != null) { ShowCardInfo(); } }
private void RefreshMainWeaponData() { int mainWeaponId = PlayerDataMgr.singleton.GetUseWeaponID(); if (curMainWeaponRes != null && curMainWeaponRes.id == mainWeaponId) { return; } curMainWeaponRes = TableMgr.singleton.GunCardTable.GetItemByID(mainWeaponId); InitRole(); }
public void SetTestValues(GunCard_TableItem gunData, bool isFight, bool isLock) { var weaponDropDown = m_DropdownTemp.gameObject.GetComponent <Dropdown>(); int selectIndex = selectList.IndexOf(gunData); if (selectIndex >= 0) { weaponDropDown.value = selectIndex; } fightToggle.isOn = isFight; lockToggle.isOn = isLock; }
public void Init(int id) { gunCardRes = TableMgr.singleton.GunCardTable.GetItemByID(id); if (gunCardRes == null) { return; } TipsTitle.text.text = LanguageMgr.GetText(gunCardRes.tid_name); IconBtn.image.sprite = Resources.Load(gunCardRes.icon, typeof(Sprite)) as Sprite; Frame.image.sprite = Resources.Load(TableMgr.singleton.ValueTable.GetCardQualityFrame(gunCardRes.rarity), typeof(Sprite)) as Sprite; }
public virtual void InitByCardData(GunCard_TableItem cardData) { InitBaseInfo(null); if (cardData != null) { m_DtTime = 1 / cardData.atkSpeed; m_Damage = cardData.atk; } if (m_Player != null) { m_Player.GetFight().SetRadius(AtkRange); m_Scale = 1 / m_Player.transform.lossyScale.x; } }
public void Init(Transform adaptNode, int npcIndex, Action <int, GunCard_TableItem, bool, bool> callback) { m_NpcIndex = npcIndex; m_Callback = callback; pointData = CampsiteMgr.singleton.GetPointByIndex(npcIndex); GunCard_TableItem gunData = null; if (pointData.equipGunId > 0) { gunData = TableMgr.singleton.GunCardTable.GetItemByID(pointData.equipGunId); } InitWeaponDropDown(pointData.buildingRes.gunType); SetTestValues(gunData, false, false); m_TitleText.text.text = string.Format("npc{0}, lv{1}", npcIndex + 1, pointData.Lv); m_TaskAdaptNode.rectTransform.anchoredPosition = UiTools.WorldToRectPos(gameObject, adaptNode.position, m_CanvasRect); }
public void ChangeGun(GunCard_TableItem gunData) { if (gunData == null) { gunData = defaultGunData; } if (m_GunData != gunData) { if (m_Gun != null) { Destroy(m_Gun.gameObject); } var gunObj = Global.gApp.gResMgr.InstantiateObj("Prefabs/WeaponNew/" + gunData.prefab); gunObj.transform.SetParent(m_WeaponNode, false); m_Gun = gunObj.GetComponent <Gun>(); m_Gun.InitByCardData(gunData); m_GunData = gunData; } }
public override void Init <T>(string name, UIInfo info, T arg) { base.Init(name, info, arg); optCardRes = arg as GunCard_TableItem; if (optCardRes == null) { opt = GunListOpt.AddFuseGun; } else if (optCardRes.id == PlayerDataMgr.singleton.GetUseWeaponID()) { opt = GunListOpt.ReplaceUseGun; } else if (PlayerDataMgr.singleton.GetFusedCardList().Contains(optCardRes.id)) { opt = GunListOpt.ReplaceFuseGun; } Debug.Log("opt " + opt); ShowGunCard(); }
public override void Init <T>(string name, UIInfo info, T arg) { base.Init(name, info, arg); gunCardRes = arg as GunCard_TableItem; if (gunCardRes == null) { return; } ShowCardInfo(); if (gunCardRes.id == PlayerDataMgr.singleton.GetUseWeaponID()) { RemoveBtn.gameObject.SetActive(false); ReplaceBtn.gameObject.SetActive(true); } else if (PlayerDataMgr.singleton.GetFusedCardList().Contains(gunCardRes.id)) { RemoveBtn.gameObject.SetActive(true); ReplaceBtn.gameObject.SetActive(true); } else { RemoveBtn.gameObject.SetActive(false); ReplaceBtn.gameObject.SetActive(false); } if (CampsiteMgr.singleton.CheckCardIsOccupied(gunCardRes.id, out occupiedByCampPoint)) { CampDataChangeBubble.CardCampDataChangeBubble.Init(gunCardRes.id, occupiedByCampPoint); OccupiedFlag.gameObject.SetActive(true); } else { occupiedByCampPoint = -1; OccupiedFlag.gameObject.SetActive(false); } }
private void InitWeaponDropDown(int gunType) { var weaponDropDown = m_DropdownTemp.gameObject.GetComponent <Dropdown>(); selectList = new List <GunCard_TableItem>(); selectList.Add(null); List <string> selectNameList = new List <string>(); selectNameList.Add("None"); var gunCards = PlayerDataMgr.singleton.GetCardsByType(gunType); for (int i = 0; i < gunCards.Count; i++) { GunCard_TableItem item = TableMgr.singleton.GunCardTable.GetItemByID(gunCards[i]); selectList.Add(item); selectNameList.Add(item.name); } weaponDropDown.AddOptions(selectNameList); weaponDropDown.onValueChanged.AddListener(OnDropdownChange); }
private void OnOkBtnClick() { GunCard_TableItem selectItem = null; if (selectList != null && selectIndex >= 0 && selectIndex < selectList.Count) { selectItem = selectList[selectIndex]; } if (pointData != null) { if (selectItem == null) { CampsiteMgr.singleton.PointRemoveGun(pointData.index); } else { CampsiteMgr.singleton.PointEquipGun(pointData.index, selectItem.id); } //pointData.ClaimReward(); //pointData.SetTestAuto(fightToggle.isOn); } TouchClose(); }
public void Init(GunCard_TableItem res) { gunCardRes = res; if (gunCardRes == null) { return; } NameTxt.text.text = LanguageMgr.GetText(gunCardRes.tid_name); Icon.image.sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(gunCardRes.icon); Frame.image.sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(TableMgr.singleton.ValueTable.GetCardQualityFrame(gunCardRes.rarity)); EffectImg.image.sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(TableMgr.singleton.ValueTable.GetCardQualityEffectImg(gunCardRes.rarity)); var cardData = PlayerDataMgr.singleton.GetGunCardData(gunCardRes.id); if (cardData == null) { return; } var gunTypeRes = TableMgr.singleton.GunTypeTable.GetItemByID(gunCardRes.gunType); if (gunTypeRes == null) { return; } //TypeTxt.text.text = gunTypeRes.gunType; TypeIcon.image.sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(gunTypeRes.icon); LevelTxt.text.text = string.Format("Lv.{0}", cardData.level); var gunStarRes = TableMgr.singleton.CardStarTable.GetItemByID(cardData.star); if (gunStarRes == null) { return; } for (int i = 0; i < starList.Count; ++i) { if (i < gunStarRes.star) { starList[i].SetActive(true); } else { starList[i].SetActive(false); } } CurAtk.text.text = (cardData.DPS() / TableMgr.singleton.ValueTable.combat_capability).ToString("f0"); var fuseSkillRes = TableMgr.singleton.FuseGunSkillTable.GetItemByID(cardData.fuseSkillID); if (fuseSkillRes == null) { return; } FuseSkillName.text.text = LanguageMgr.GetText(fuseSkillRes.tid_name); FuseSkillLevel.text.text = string.Format("Lv.{0}", fuseSkillRes.level); if (gunCardRes.id == PlayerDataMgr.singleton.GetUseWeaponID()) { EquipTxt.gameObject.SetActive(true); FuseTxt.gameObject.SetActive(false); } else if (PlayerDataMgr.singleton.DB.fusedCardList.Contains(gunCardRes.id)) { EquipTxt.gameObject.SetActive(false); FuseTxt.gameObject.SetActive(true); } else { EquipTxt.gameObject.SetActive(false); FuseTxt.gameObject.SetActive(false); } }
private void ShowGunCard() { ClearShowList(); SortCards(); foreach (var point in fuesRedPointList) { point.gameObject.SetActive(true); } curMainWeaponRes = TableMgr.singleton.GunCardTable.GetItemByID(PlayerDataMgr.singleton.GetUseWeaponID()); if (curMainWeaponRes != null) { var itemUI = GunCard.GetInstance(); itemUI.Init(curMainWeaponRes); itemUI.transform.SetParent(MainGunBtn.gameObject.transform); itemUI.transform.localPosition = Vector3.zero; itemUI.transform.localScale = Vector3.one; itemUI.gameObject.SetActive(true); showGunList.Add(itemUI); } var cardData = PlayerDataMgr.singleton.GetGunCardData(curMainWeaponRes.id); if (cardData != null) { var skillUI = GunSkill.GetInstance(); skillUI.InitFuseSkill(cardData.fuseSkillID); skillUI.transform.SetParent(MainGunSkillBtn.gameObject.transform); skillUI.transform.localPosition = Vector3.zero; skillUI.gameObject.SetActive(true); showSkillList.Add(skillUI); FirePower.text.text = (PlayerDataMgr.singleton.GetUseWeaponPower() / TableMgr.singleton.ValueTable.combat_capability).ToString("f0"); } for (int i = 0; i < PlayerDataMgr.singleton.DB.fusedCardList.Count; i++) { var cardRes = TableMgr.singleton.GunCardTable.GetItemByID(PlayerDataMgr.singleton.DB.fusedCardList[i]); if (cardRes == null) { continue; } var itemUI = GunCard.GetInstance(); itemUI.Init(cardRes); itemUI.transform.SetParent(fuesRootList[i].transform); itemUI.transform.localPosition = Vector3.zero; itemUI.gameObject.SetActive(true); showGunList.Add(itemUI); fuesRedPointList[i].gameObject.SetActive(false); cardData = PlayerDataMgr.singleton.GetGunCardData(cardRes.id); if (cardData == null) { continue; } var skillUI = GunSkill.GetInstance(); skillUI.InitFuseSkill(cardData.fuseSkillID); skillUI.transform.SetParent(skillRootList[i].transform); skillUI.transform.localPosition = Vector3.zero; skillUI.gameObject.SetActive(true); showSkillList.Add(skillUI); } foreach (var item in cardResList) { if (PlayerDataMgr.singleton.DB.fusedCardList.Contains(item.id) || item.id == curMainWeaponRes.id) { //obj = ResourceMgr.singleton.AddGameInstanceAsSubObject("UI/HeroCard", chooseRoot); continue; } else { if (PlayerDataMgr.singleton.GetGunCardData(item.id) == null) { var itemUI = GunCard.GetInstance(); itemUI.Init(item); itemUI.transform.SetParent(LockCards.gameObject.transform); itemUI.transform.localPosition = Vector3.zero; itemUI.gameObject.SetActive(true); showGunList.Add(itemUI); } else { var itemUI = GunCard.GetInstance(); itemUI.Init(item); itemUI.transform.SetParent(HeroCards.gameObject.transform); itemUI.transform.localPosition = Vector3.zero; itemUI.gameObject.SetActive(true); showGunList.Add(itemUI); } } } GunCount.text.text = string.Format("{0}/{1}", PlayerDataMgr.singleton.GetCollectCardCount(), TableMgr.singleton.GunCardTable.ItemCount); GunCard.gameObject.SetActive(false); foreach (var child in ScrollView.gameObject.GetComponentsInChildren <ContentSizeFitter>(true)) { LayoutRebuilder.ForceRebuildLayoutImmediate(child.GetComponent <RectTransform>()); } InitRole(); }
public override void InitByCardData(GunCard_TableItem cardData) { base.InitByCardData(cardData); m_CacheDamage = m_Damage; m_Damage = 0; }
public FightWeaponMgr(Player player, int defaultWeapon = 0) { m_GunCardData = PlayerDataMgr.singleton.GetUseWeapon(); if (m_GunCardData == null) { return; } m_WeaponRes = TableMgr.singleton.GunCardTable.GetItemByID(m_GunCardData.cardID); if (m_WeaponRes == null) { Debug.LogError("m_WeaponData = null"); return; } //string firstGunName = Global.gApp.gSystemMgr.GetWeaponMgr().GetCurMainWeapon();//GameConstVal.WLaserX; string firstGunName = m_WeaponRes.prefab; string newWpnName = firstGunName; //if (Global.gApp.gSystemMgr.GetWeaponMgr().GetQualityLv(firstGunName) > 0) //{ // newWpnName = newWpnName + "_s"; //} Debug.Log("firstGunName " + firstGunName); m_Player = player; m_WeaponNodeTsf = player.transform.Find("ModelNode/hero/weapon_bip_real"); m_FirstWeapon = Global.gApp.gResMgr.InstantiateObj("Prefabs/WeaponNew/" + newWpnName); m_FirePoint = m_WeaponNodeTsf.parent.Find(GameConstVal.FirePoint).gameObject; m_FirstWeapon.transform.SetParent(m_WeaponNodeTsf, false); m_FirstGun = m_FirstWeapon.GetComponent <Gun>(); m_CurFirstWeapon = m_FirstWeapon; m_FirstWeaponName = firstGunName; InitCombatAttr(); //ReviseCombatAttrValue(CombatAttr.CombatAttrType.Attack, m_WeaponRes.atk); //ReviseCombatAttrValue(CombatAttr.CombatAttrType.Attack_Speed_Add, m_WeaponRes.atkSpeed); var skills = PlayerDataMgr.singleton.GetFuseSkills(); for (int i = 0; i < skills.Count; ++i) { var data = TableMgr.singleton.FuseGunSkillTable.GetItemByID(skills[i]); if (data == null) { continue; } var type = (CombatAttr.CombatAttrType)(data.id / 100); ReviseCombatAttrValue(type, data.value); } //if (Global.gApp.CurScene.IsNormalPass()) //{ // string secondGunName = Global.gApp.gSystemMgr.GetWeaponMgr().GetCurSubWeapon();//GameConstVal.WLaserX; // if (secondGunName != null && !secondGunName.Equals(GameConstVal.EmepyStr)) // { // m_SecondWeapon = Global.gApp.gResMgr.InstantiateObj("Prefabs/Weapon/" + secondGunName); // m_SecondWeapon.transform.SetParent(m_WeaponNodeTsf, false); // m_SecondGun = m_SecondWeapon.GetComponent<Gun>(); // m_CurSecondWeapon = m_SecondWeapon; // } //} }
public void Init(GunCard_TableItem res) { gunCardRes = res; if (gunCardRes == null) { return; } TipsTitle.text.text = LanguageMgr.GetText(gunCardRes.tid_name); IconBtn.image.sprite = Resources.Load(gunCardRes.icon, typeof(Sprite)) as Sprite; Frame.image.sprite = Resources.Load(TableMgr.singleton.ValueTable.GetCardQualityFrame(gunCardRes.rarity), typeof(Sprite)) as Sprite; int occupiedPointIndex; if (CampsiteMgr.singleton.CheckCardIsOccupied(res.id, out occupiedPointIndex)) { OccupiedFlag.gameObject.SetActive(true); } else { OccupiedFlag.gameObject.SetActive(false); } var cardData = PlayerDataMgr.singleton.GetGunCardData(gunCardRes.id); if (cardData == null) { ChipCount.gameObject.SetActive(false); Level.gameObject.SetActive(false); IconBtn.button.enabled = false; if (LvupIcon.gameObject != null) { LvupIcon.gameObject.SetActive(false); } if (StarupIcon.gameObject != null) { StarupIcon.gameObject.SetActive(false); } for (int i = 0; i < starList.Count; ++i) { starList[i].SetActive(false); } return; } ChipCount.gameObject.SetActive(true); Level.gameObject.SetActive(true); IconBtn.button.enabled = true; ChipCount.text.text = cardData.count.ToString(); var gunStarRes = TableMgr.singleton.CardStarTable.GetItemByID(cardData.star); if (gunStarRes == null) { return; } Level.text.text = string.Format("Lv.{0}", cardData.level); for (int i = 0; i < starList.Count; ++i) { if (i < gunStarRes.star) { starList[i].SetActive(true); } else { starList[i].SetActive(false); } } if (state == State.GunOpt) { if (LvupIcon.gameObject != null) { if (PlayerDataMgr.singleton.CanCardLvUp(gunCardRes.id)) { LvupIcon.gameObject.SetActive(true); } else { LvupIcon.gameObject.SetActive(false); } } if (StarupIcon.gameObject != null) { if (PlayerDataMgr.singleton.CanCardStarUp(gunCardRes.id)) { StarupIcon.gameObject.SetActive(true); } else { StarupIcon.gameObject.SetActive(false); } } } if (NewIcon != null) { NewIcon.gameObject.SetActive(cardData.isNew); } }