void OnAkeyLevelupOk() { SwordsManContainer Container = GameManager.gameManager.PlayerDataPool.GetSwordsManContainer(m_PackType); if (Container == null) { LogModule.ErrorLog("OnAkeyLevelupOk::Container is null"); return; } SwordsMan oSwordsMan = Container.GetSwordsManByGuid(m_SwordsManGuid); if (oSwordsMan == null) { LogModule.ErrorLog("OnAkeyLevelupOk::oSwordsMan is null"); return; } CG_SWORDSMAN_LEVELUP packet = (CG_SWORDSMAN_LEVELUP)PacketDistributed.CreatePacket(MessageID.PACKET_CG_SWORDSMAN_LEVELUP); packet.Swordsmanid = oSwordsMan.Guid; packet.Eatallswordsman = 1; packet.Packtype = (int)m_PackType; packet.FilterQuality = (int)m_curChooseQuality; for (int i = 0; i < m_EatGuidlist.Count; ++i) { packet.AddEatguid(m_EatGuidlist[i]); } packet.SendPacket(); }
/// <summary> /// 设置升级侠客信息 /// </summary> void SetLevelUpSwordsMan(SwordsMan oSwordsMan, SwordsManToolTipsLogic.SwordsMan_ShowType ShowType) { m_curChooseQuality = SwordsMan.SWORDSMANQUALITY.ORANGE; m_bClearAllSelect = false; m_SwordsManGuid = oSwordsMan.Guid; if (null == oSwordsMan) { LogModule.ErrorLog("SetLevelUpSwordsMan::oSwordsMan is null"); return; } if (SwordsManToolTipsLogic.SwordsMan_ShowType.Equiped == ShowType) { m_PackType = SwordsManContainer.PACK_TYPE.TYPE_EQUIPPACK; } else if (SwordsManToolTipsLogic.SwordsMan_ShowType.UnEquiped == ShowType) { m_PackType = SwordsManContainer.PACK_TYPE.TYPE_BACKPACK; } else { LogModule.ErrorLog("SetLevelUpSwordsMan::ShowType invalid"); return; } if (m_LabelTips != null) { m_LabelTips.text = StrDictionary.GetClientDictionaryString("#{2719}"); } UpdateSwordsManBackPack(); UpdateSwordsManInfo(); }
public override void DetectEnemy() { base.DetectEnemy(); Vector3 directionToSwordsMan = (SwordsMan.getInstance().transform.position - this.transform.position).normalized; Debug.DrawRay(this.transform.position, directionToSwordsMan * rayDistance, Color.red); Debug.DrawRay(this.transform.position, lookDirection * rayDistance, Color.yellow); Debug.DrawRay(this.transform.position, (lookDirection - fovDirectionLeft) * rayDistance, Color.yellow); Debug.DrawRay(this.transform.position, (lookDirection - fovDirectionRight) * rayDistance, Color.yellow); angleFormed = MathUtilities.AngleBetweenVectors(lookDirection.normalized, directionToSwordsMan); if (MathUtilities.AngleBetweenVectors(lookDirection.normalized, directionToSwordsMan) >= 0 && MathUtilities.AngleBetweenVectors(lookDirection.normalized, directionToSwordsMan) <= (fovAngle)) { Debug.DrawRay(this.transform.position, lookDirection * rayDistance, Color.green); Debug.DrawRay(this.transform.position, (lookDirection - fovDirectionLeft) * rayDistance, Color.green); Debug.DrawRay(this.transform.position, (lookDirection - fovDirectionRight) * rayDistance, Color.green); } else { Debug.DrawRay(this.transform.position, lookDirection * rayDistance, Color.yellow); Debug.DrawRay(this.transform.position, (lookDirection - fovDirectionLeft) * rayDistance, Color.yellow); Debug.DrawRay(this.transform.position, (lookDirection - fovDirectionRight) * rayDistance, Color.yellow); } }
public override void DetectEnemy() { RaycastHit hit; base.DetectEnemy(); Debug.Log("SwordsMan forward: " + transform.forward); if (Physics.Raycast(transform.position, transform.forward, out hit, 1.0f)) { if (hit.collider.gameObject.tag == "Enemy") { enemyDetected = true; SwordsMan.getInstance().enableTranslation = false; SwordsManAnimationStates.getInstance().NoTranslation(); currentEnemy = hit.collider.gameObject.GetComponent <Warrior>(); SwordsManAttack.getInstance().CheckEnemyDirection(currentEnemy); } } else { enemyDetected = false; currentEnemy = null; } }
/// <summary> /// /// </summary> void OnClickEquipSwordsMan8() { SwordsMan oSwordsMan = GameManager.gameManager.PlayerDataPool.SwordsManEquipPack.GetSwordsMan(7); if (oSwordsMan != null && oSwordsMan.IsValid()) { SwordsManToolTipsLogic.ShowSwordsManTooltip(oSwordsMan, SwordsManToolTipsLogic.SwordsMan_ShowType.Equiped); } }
/// <summary> /// /// </summary> void ShowSwordsManExp() { if (null == m_LabelExp) { return; } if (null == m_SliderExp) { return; } if (null == m_ExpTitle) { return; } SwordsManContainer Container = GameManager.gameManager.PlayerDataPool.GetSwordsManContainer(m_PackType); if (Container == null) { return; } SwordsMan oSwordsMan = Container.GetSwordsManByGuid(m_SwordsManGuid); if (oSwordsMan == null) { return; } if (oSwordsMan.IsFullLevel()) { m_LabelExp.gameObject.SetActive(false); m_SliderExp.gameObject.SetActive(false); m_ExpTitle.SetActive(false); return; } m_LabelExp.gameObject.SetActive(true); m_SliderExp.gameObject.SetActive(true); m_ExpTitle.SetActive(true); if (m_nEatExp > 0) { //m_LabelExp.text = string.Format("{0}+[33c8ff]{1}[-]/{2}", oSwordsMan.Exp, m_nEatExp, oSwordsMan.MaxExp); m_LabelExp.text = StrDictionary.GetClientDictionaryString("#{3338}", oSwordsMan.Exp, m_nEatExp, oSwordsMan.MaxExp); } else { //m_LabelExp.text = string.Format("{0}/{1}", oSwordsMan.Exp, oSwordsMan.MaxExp); m_LabelExp.text = StrDictionary.GetClientDictionaryString("#{3337}", oSwordsMan.Exp, oSwordsMan.MaxExp); } int nMaxExp = oSwordsMan.MaxExp; if (nMaxExp > 0) { float fSlider = (float)oSwordsMan.Exp / (float)nMaxExp; m_SliderExp.value = fSlider; } }
void GameBegins() { SwordsManAnimationStates.getInstance().Translate(); SwordsMan.getInstance().enableTranslation = true; SwordsMan.getInstance().RotateTowards(SwordsMan.getInstance().nextDestination); gameStatus = GameStatus.Playing; }
/// <summary> /// /// </summary> /// <param name="item"></param> public void OnSelectSwordsManItem(SwordsManItem item) { SwordsManContainer Container = GameManager.gameManager.PlayerDataPool.GetSwordsManContainer(m_PackType); if (Container == null) { return; } SwordsMan oSwordsMan = Container.GetSwordsManByGuid(m_SwordsManGuid); if (oSwordsMan == null) { return; } if (item == null) { return; } if (item.m_oSwordsMan == null) { return; } if (item.m_oSwordsMan.Quality > oSwordsMan.Quality) { GUIData.AddNotifyData("#{2497}"); return; } if (item.m_oSwordsMan.Locked) { return; } if (item.m_oSwordsMan.Guid != oSwordsMan.Guid) { item.OnSelectSwordsMan(); if (item.IsSelect()) { m_nEatExp += item.m_oSwordsMan.GetEatExp(); } else { m_nEatExp -= item.m_oSwordsMan.GetEatExp(); } ShowSwordsManExp(); } else { GUIData.AddNotifyData("#{2557}"); } }
/// <summary> /// /// </summary> /// <param name="ShopSwordsManTable"></param> public void SetShopSwordsMan(Tab_SwordsManScoreShop ShopSwordsManTable) { if (null == ShopSwordsManTable) { LogModule.ErrorLog("SetShopSwordsManShop::ShopSwordsManTable is null"); return; } Tab_SwordsManAttr SwordsManAttrTable = TableManager.GetSwordsManAttrByID(ShopSwordsManTable.Id, 0); if (null == SwordsManAttrTable) { LogModule.ErrorLog("m_SwordsManAttrTable::SwordsManAttrTable is null"); return; } m_SwordsManDataID = SwordsManAttrTable.Id; m_nPrice = ShopSwordsManTable.ScorePrice; m_strName = SwordsManAttrTable.Name; if (m_LableName != null) { m_LableName.text = SwordsManAttrTable.Name; } if (m_LabelDesc != null) { m_LabelDesc.text = SwordsManAttrTable.Tips; } if (m_LabelPrice != null) { if (GameManager.gameManager.PlayerDataPool != null && GameManager.gameManager.PlayerDataPool.SwordsManScore >= m_nPrice) { m_LabelPrice.text = ShopSwordsManTable.ScorePrice.ToString(); } else { m_LabelPrice.text = "[ff0000]" + ShopSwordsManTable.ScorePrice.ToString(); } } if (m_IconSprite != null) { m_IconSprite.spriteName = SwordsManAttrTable.Icon; } if (m_QualitySprite != null) { m_QualitySprite.spriteName = SwordsMan.GetQualitySpriteName((SwordsMan.SWORDSMANQUALITY)SwordsManAttrTable.Quality); } if (m_HightLightBkSprite != null) { m_HightLightBkSprite.SetActive(false); } }
protected override void OnTriggerEnter(Collider col) { base.OnTriggerEnter(col); if (col.gameObject.tag == GameTags.WarriorsTags.SwordsMan.ToString()) { SwordsMan.getInstance().transform.position = new Vector3(this.transform.position.x, 0.0f, transform.position.z); SwordsMan.getInstance().attackForce += this.forceAttack; SwordsMan.getInstance().RotateTowards(this.nextDestination); Destroy(this.gameObject); } }
/// <summary> /// 侠客图标显示 /// </summary> void ShowSwordsManIcon() { if (m_SwordsMan == null) { return; } if (m_SpriteIcon != null) { m_SpriteIcon.spriteName = m_SwordsMan.GetIcon(); } if (m_SpriteQuality != null) { m_SpriteQuality.spriteName = SwordsMan.GetQualitySpriteName((SwordsMan.SWORDSMANQUALITY)m_SwordsMan.Quality);; } }
private void ShowTooltips(SwordsMan oSwordsMan, SwordsMan_ShowType ShowType) { if (null == oSwordsMan) { LogModule.ErrorLog("ShowTooltips::ShowTooltips is null"); return; } m_SwordsMan = oSwordsMan; m_ShowType = ShowType; HideAllButton(); ShowSwordsManIcon(); ShowSwordsManName(); ShowSwordsManLevel(); ShowSwordsManExp(); ShowSwordsManEffect(); ShowSwordsManButton(); }
void AttackDamage() { if (SwordsManEnemyDetection.getInstance().currentEnemy != null) { if (SwordsManEnemyDetection.getInstance().currentEnemy.status != WarriorStatus.Dead) { enemyDamageSystem.GotDamage(SwordsMan.getInstance().attackForce); } if (SwordsManEnemyDetection.getInstance().currentEnemy.status == WarriorStatus.Dead) { SwordsManAnimationStates.getInstance().NoTranslation(); SwordsMan.getInstance().nextDestination = SwordsManEnemyDetection.getInstance().currentEnemy.nextDestination; SwordsManEnemyDetection.getInstance().currentEnemy = null; } } }
/// <summary> /// /// </summary> void OnLoadSwordsManItem(GameObject resObj, object param) { if (null == m_SwordsManGrid) { LogModule.ErrorLog("OnLoadSwordsManItem m_SwordsManGrid is null"); return; } Utils.CleanGrid(m_SwordsManGrid.gameObject); SwordsManContainer oSwordsManContainer = GameManager.gameManager.PlayerDataPool.GetSwordsManContainer(SwordsManContainer.PACK_TYPE.TYPE_BACKPACK); if (null == oSwordsManContainer) { LogModule.ErrorLog("OnLoadSwordsManItem::oSwordsManContainer is null"); return; } List <SwordsMan> itemlist = SwordsManTool.ItemFilter(oSwordsManContainer); for (int i = 0; i < itemlist.Count; i++) { SwordsMan oSwordsMan = itemlist[i]; if (null == oSwordsMan) { LogModule.ErrorLog("OnLoadSwordsManItem::oSwordsMan is null"); break; } if (false == oSwordsMan.IsValid()) { continue; } SwordsManItem oSwordsManItem = SwordsManItem.CreateItem(m_SwordsManGrid, resObj, i.ToString(), this); if (null == oSwordsManItem) { LogModule.ErrorLog("OnLoadSwordsManItem::oSwordsManItem is null"); break; } oSwordsManItem.SetData(oSwordsMan); } m_SwordsManGrid.GetComponent <UIGrid>().repositionNow = true; if (m_LabelPacSize != null) { m_LabelPacSize.text = StrDictionary.GetClientDictionaryString("#{3337}", oSwordsManContainer.GetSwordsManCount(), oSwordsManContainer.ContainerSize); } }
public void UpdateSwordsManInfo() { if (null == m_LableName) { return; } if (null == m_LabelLevelValue) { return; } if (null == m_LabelDesc) { return; } SwordsManContainer Container = GameManager.gameManager.PlayerDataPool.GetSwordsManContainer(m_PackType); if (Container == null) { return; } SwordsMan oSwordsMan = Container.GetSwordsManByGuid(m_SwordsManGuid); if (oSwordsMan == null) { return; } m_LableName.text = oSwordsMan.Name; m_LabelLevelValue.text = oSwordsMan.Level.ToString(); m_LabelDesc.text = oSwordsMan.GetTips(); if (m_SpriteIcon != null) { m_SpriteIcon.spriteName = oSwordsMan.GetIcon(); } if (m_SpriteQuality != null) { m_SpriteQuality.spriteName = SwordsMan.GetQualitySpriteName((SwordsMan.SWORDSMANQUALITY)oSwordsMan.Quality);; } ShowSwordsManExp(); ShowSwordsManEffect(); }
protected override void OnTriggerEnter(Collider col) { base.OnTriggerEnter(col); if (col.gameObject.tag == GameTags.WarriorsTags.SwordsMan.ToString()) { SwordsMan.getInstance().transform.position = new Vector3(this.transform.position.x, 0.0f, transform.position.z); SwordsMan.getInstance().attackForce += this.forceAttack; SwordsMan.getInstance().RotateTowards(this.nextDestination); SpearMan.getInstance().transform.Rotate(Vector3.up, 21.94f); if (generateGreen) { Instantiate(greenCube, this.nextDestination + this.transform.position, Quaternion.identity); } Destroy(this.gameObject); } }
public override void DetectEnemy() { base.DetectEnemy(); Vector3 directionToSwordsMan = (SwordsMan.getInstance().transform.position - this.transform.position).normalized; Debug.DrawRay(this.transform.position, directionToSwordsMan * rayDistance, Color.yellow); Debug.DrawRay(this.transform.position, (lookDirection - fovDirection) * rayDistance, Color.yellow); Debug.DrawRay(this.transform.position, (lookDirection + (fovDirection)) * rayDistance, Color.blue); Debug.Log(transform.eulerAngles.y); if (MathUtilities.AngleBetweenVectors(lookDirection.normalized, directionToSwordsMan) >= 0 && MathUtilities.AngleBetweenVectors(lookDirection.normalized, directionToSwordsMan) <= (fovAngle / 2)) { enemyDetected = true; } else { enemyDetected = false; } }
/// <summary> /// 设置侠客信息 /// </summary> public void SetData(SwordsMan oSwordsMan) { if (oSwordsMan == null) { ClearUp(); return; } m_oSwordsMan = oSwordsMan; m_Status = Status.STATUS_ENABLE; if (null == m_IconSprite) { return; } if (null == m_QualitySprite) { return; } if (m_LableLevel != null) { m_LableLevel.text = "LV" + m_oSwordsMan.Level.ToString(); } m_IconSprite.spriteName = m_oSwordsMan.GetIcon(); m_QualitySprite.spriteName = SwordsMan.GetQualitySpriteName((SwordsMan.SWORDSMANQUALITY)m_oSwordsMan.Quality); OnSelectStateChange(); //m_LabelLevelValue.text = m_oSwordsMan.Level.ToString(); //m_LabelDesc.text = m_oSwordsMan.GetTips(); //m_LabelCurEffect.text = m_oSwordsMan.GetCombatValue().ToString(); //m_LabelExp.text = m_oSwordsMan.Exp.ToString(); //int nMaxExp = m_oSwordsMan.MaxExp; //if (nMaxExp > 0) //{ // float fSlider = (float)m_oSwordsMan.Exp / (float)nMaxExp; // m_SliderExp.value = fSlider; //} }
void OnClickShopItem() { if (null == m_Parent) { LogModule.ErrorLog("OnClickShopItem::m_Parent null"); return; } Tab_SwordsManAttr SwordsManAttrTable = TableManager.GetSwordsManAttrByID(m_SwordsManDataID, 0); if (null == SwordsManAttrTable) { LogModule.ErrorLog("OnClickShopItem::SwordsManAttrTable is null"); return; } SwordsMan oSwordsMan = new SwordsMan(); oSwordsMan.DataId = m_SwordsManDataID; oSwordsMan.Name = SwordsManAttrTable.Name; oSwordsMan.Quality = SwordsManAttrTable.Quality; oSwordsMan.Level = 1; SwordsManToolTipsLogic.ShowSwordsManTooltip(oSwordsMan, SwordsManToolTipsLogic.SwordsMan_ShowType.ScoreShop); m_Parent.OnShopSwordsManClick(this); }
/// <summary> /// /// </summary> public void UpdateSwordsManEquipPack() { SwordsManContainer oSwordsManContainer = GameManager.gameManager.PlayerDataPool.GetSwordsManContainer(SwordsManContainer.PACK_TYPE.TYPE_EQUIPPACK); if (null == oSwordsManContainer) { LogModule.ErrorLog("UpdateSwordsManEquipPack::oSwordsManContainer is null"); return; } int nCombatValue = 0; for (int i = 0; i < m_SwordsManIcons.Length && i < m_SwordsManQualitys.Length && i < m_SwordsManLock.Length && i < m_SlotLock.Length && i < m_SwordsManLevel.Length && i < m_LabelSlots.Length; i++) { if (i < oSwordsManContainer.ContainerSize) { SwordsMan oSwordsMan = oSwordsManContainer.GetSwordsMan(i); if (null == oSwordsMan) { LogModule.ErrorLog("OnLoadSwordsManItem::oSwordsMan is null"); break; } m_SlotLock[i].SetActive(false); if (oSwordsMan.IsValid()) { m_SwordsManIcons[i].SetActive(true); m_SwordsManIcons[i].GetComponent <UISprite>().spriteName = oSwordsMan.GetIcon(); m_SwordsManQualitys[i].GetComponent <UISprite>().spriteName = SwordsMan.GetQualitySpriteName((SwordsMan.SWORDSMANQUALITY)oSwordsMan.Quality); m_SwordsManQualitys[i].SetActive(true); m_SwordsManLevel[i].gameObject.SetActive(true); m_SwordsManLevel[i].text = StrDictionary.GetClientDictionaryString("#{2673}", oSwordsMan.Level); if (oSwordsMan.Locked) { m_SwordsManLock[i].SetActive(true); } else { m_SwordsManLock[i].SetActive(false); } nCombatValue = nCombatValue + oSwordsMan.GetCombatValue(); } else { m_SwordsManQualitys[i].SetActive(false); m_SwordsManIcons[i].SetActive(false); m_SwordsManLock[i].SetActive(false); m_SwordsManLevel[i].gameObject.SetActive(false); } m_LabelSlots[i].gameObject.SetActive(false); } else { //需要解锁 m_SlotLock[i].SetActive(true); m_SwordsManQualitys[i].SetActive(false); m_SwordsManIcons[i].SetActive(false); m_LabelSlots[i].gameObject.SetActive(true); m_SwordsManLevel[i].gameObject.SetActive(false); Tab_SwordsEquipPackUnlock SwordsManUnLockTable = TableManager.GetSwordsEquipPackUnlockByID(i + 1, 0); if (SwordsManUnLockTable != null) { //string strUnLock = SwordsManUnLockTable.NeedLevel.ToString() + "级开放"; string strUnLock = StrDictionary.GetClientDictionaryString("#{2674}", SwordsManUnLockTable.NeedLevel); m_LabelSlots[i].text = strUnLock; } } } if (m_LabelCombatValue != null) { m_LabelCombatValue.text = nCombatValue.ToString(); } }
void ShowSwordsManEffect() { SwordsManContainer Container = GameManager.gameManager.PlayerDataPool.GetSwordsManContainer(m_PackType); if (Container == null) { return; } SwordsMan oSwordsMan = Container.GetSwordsManByGuid(m_SwordsManGuid); if (oSwordsMan == null) { LogModule.ErrorLog("ShowSwordsManEffect::oSwordsMan is null"); return; } Tab_SwordsManAttr pAttrTable = TableManager.GetSwordsManAttrByID(oSwordsMan.DataId, 0); if (null == pAttrTable) { LogModule.ErrorLog("ShowSwordsManEffect::pAttrTable is null"); return; } for (int i = 0; i < m_LabelCurEffect.Length; i++) { m_LabelCurEffect[i].gameObject.SetActive(false); } for (int i = 0; i < m_LabelNextEffect.Length; i++) { m_LabelNextEffect[i].gameObject.SetActive(false); } int nCurEffectIndex = 0; int nNextEffectIndex = 0; for (int i = 0; i < pAttrTable.getAddAttrTypeCount(); i++) { COMBATATTE nAttrType = (COMBATATTE)pAttrTable.GetAddAttrTypebyIndex(i); int nAttrValue = oSwordsMan.GetComBatAttrById(nAttrType); int nNextLevelAttrValue = oSwordsMan.GetNextLevelComBatAttrById(nAttrType); if (nAttrValue > 0 && nCurEffectIndex < m_LabelCurEffect.Length && nCurEffectIndex >= 0) { //m_LabelCurEffect[nCurEffectIndex].text = string.Format("{0}+{1}", ItemTool.ConvertAttrToString(nAttrType), nAttrValue.ToString()); m_LabelCurEffect[nCurEffectIndex].text = StrDictionary.GetClientDictionaryString("#{3339}", ItemTool.ConvertAttrToString(nAttrType), nAttrValue.ToString()); m_LabelCurEffect[nCurEffectIndex].gameObject.SetActive(true); ++nCurEffectIndex; } if (nNextLevelAttrValue > 0 && nNextEffectIndex < m_LabelNextEffect.Length && nNextEffectIndex >= 0) { //m_LabelNextEffect[nNextEffectIndex].text = string.Format("{0}+{1}", ItemTool.ConvertAttrToString(nAttrType), nNextLevelAttrValue.ToString()); m_LabelNextEffect[nNextEffectIndex].text = StrDictionary.GetClientDictionaryString("#{3339}", ItemTool.ConvertAttrToString(nAttrType), nNextLevelAttrValue.ToString()); m_LabelNextEffect[nNextEffectIndex].gameObject.SetActive(true); ++nNextEffectIndex; } } if (m_CurEffectGrid != null) { m_CurEffectGrid.SetActive(true); } if (m_CurEffectTitle != null) { m_CurEffectTitle.SetActive(true); } if (oSwordsMan.IsFullLevel()) { if (m_NextEffectGrid != null) { m_NextEffectGrid.SetActive(false); } if (m_NextEffectTitle != null) { m_NextEffectTitle.SetActive(false); } } else { if (m_NextEffectGrid != null) { m_NextEffectGrid.SetActive(true); } if (m_NextEffectTitle != null) { m_NextEffectTitle.SetActive(true); } } }
public static void OpenWindow(SwordsMan oSwordsMan, SwordsManToolTipsLogic.SwordsMan_ShowType ShowType) { m_sShowType = ShowType; m_sSwordsMan = oSwordsMan; UIManager.ShowUI(UIInfo.SwordsManLevelUpRoot, OnOpenWindow, null); }
// Start is called before the first frame update void Start() { body = GetComponentInParent <SwordsMan>(); }
public static void ShowSwordsManTooltip(SwordsMan oSwordsMan, SwordsMan_ShowType ShowType) { m_curItem = oSwordsMan; m_curType = ShowType; UIManager.ShowUI(UIInfo.SwordsManTooltipsRoot, SwordsManToolTipsLogic.OnShowEquipTip); }
void ClearUp() { m_oSwordsMan = null; }
/// <summary> /// 一键吞噬 /// </summary> void OnAkeyLevelup() { SwordsManContainer Container = GameManager.gameManager.PlayerDataPool.GetSwordsManContainer(m_PackType); if (Container == null) { LogModule.ErrorLog("OnAkeyLevelup::Container is null"); return; } SwordsMan oSwordsMan = Container.GetSwordsManByGuid(m_SwordsManGuid); if (oSwordsMan == null) { LogModule.ErrorLog("OnAkeyLevelup::oSwordsMan is null"); return; } if (null == m_GridTranForm) { LogModule.ErrorLog("OnAkeyLevelup::m_GridTranForm is null"); return; } if (null == m_EatGuidlist) { LogModule.ErrorLog("OnAkeyLevelup::m_EatGuidlist is null"); return; } m_EatGuidlist.Clear(); List <string> OrangeSwordsmanlist = new List <string>(); List <string> PurpleSwordsmanlist = new List <string>(); for (int i = 0; i < m_GridTranForm.childCount; i++) { SwordsManItem item = m_GridTranForm.GetChild(i).GetComponent <SwordsManItem>(); if (item == null) { continue; } if (item.m_Status == SwordsManItem.Status.STATUS_CHOOSED && item.m_oSwordsMan != null) { m_EatGuidlist.Add(item.m_oSwordsMan.Guid); if ((int)SwordsMan.SWORDSMANQUALITY.ORANGE == item.m_oSwordsMan.Quality) { OrangeSwordsmanlist.Add(item.m_oSwordsMan.Name); } else if ((int)SwordsMan.SWORDSMANQUALITY.PURPLE == item.m_oSwordsMan.Quality) { PurpleSwordsmanlist.Add(item.m_oSwordsMan.Name); } } } if (m_EatGuidlist.Count <= 0) { MessageBoxLogic.OpenOKBox(2675, 1000); return; } if (OrangeSwordsmanlist.Count <= 0 && PurpleSwordsmanlist.Count <= 0) { CG_SWORDSMAN_LEVELUP packet = (CG_SWORDSMAN_LEVELUP)PacketDistributed.CreatePacket(MessageID.PACKET_CG_SWORDSMAN_LEVELUP); packet.Swordsmanid = oSwordsMan.Guid; packet.Eatallswordsman = 1; packet.Packtype = (int)m_PackType; packet.FilterQuality = (int)m_curChooseQuality; for (int i = 0; i < m_EatGuidlist.Count; ++i) { packet.AddEatguid(m_EatGuidlist[i]); } packet.SendPacket(); return; } if (OrangeSwordsmanlist.Count > 0) { string strTip; if (OrangeSwordsmanlist.Count > 1) { strTip = StrDictionary.GetClientDictionaryString("#{4652}", OrangeSwordsmanlist[0], OrangeSwordsmanlist.Count); MessageBoxLogic.OpenOKCancelBox(strTip, "", OnAkeyLevelupOk); } else { strTip = StrDictionary.GetClientDictionaryString("#{4651}", OrangeSwordsmanlist[0]); MessageBoxLogic.OpenOKCancelBox(strTip, "", OnAkeyLevelupOk); } return; } if (PurpleSwordsmanlist.Count > 0) { string strTip; if (PurpleSwordsmanlist.Count > 1) { strTip = StrDictionary.GetClientDictionaryString("#{4654}", PurpleSwordsmanlist[0], PurpleSwordsmanlist.Count); MessageBoxLogic.OpenOKCancelBox(strTip, "", OnAkeyLevelupOk); } else { strTip = StrDictionary.GetClientDictionaryString("#{4653}", PurpleSwordsmanlist[0]); MessageBoxLogic.OpenOKCancelBox(strTip, "", OnAkeyLevelupOk); } return; } }
public void UseAttackForce() { SwordsMan.getInstance().attackForce = 0; }
/// <summary> /// 更新侠客信息 /// </summary> void OnLoadSwordsManItem(GameObject resObj, object param) { if (null == m_SwordsManGrid) { LogModule.ErrorLog("OnLoadSwordsManItem m_SwordsManGrid is null"); return; } Utils.CleanGrid(m_SwordsManGrid.gameObject); SwordsManContainer oSwordsManBackContainer = GameManager.gameManager.PlayerDataPool.GetSwordsManContainer(SwordsManContainer.PACK_TYPE.TYPE_BACKPACK); if (null == oSwordsManBackContainer) { LogModule.ErrorLog("OnLoadSwordsManItem::oSwordsManBackContainer is null"); return; } SwordsManContainer Container = GameManager.gameManager.PlayerDataPool.GetSwordsManContainer(m_PackType); if (null == Container) { LogModule.ErrorLog("OnLoadSwordsManItem::Container is null"); return; } SwordsMan CurSwordsMan = Container.GetSwordsManByGuid(m_SwordsManGuid); if (CurSwordsMan == null) { return; } List <SwordsMan> itemlist = SwordsManTool.ItemFilter(oSwordsManBackContainer); itemlist = SwordsManTool.ItemFilter(itemlist, (int)m_curChooseQuality); m_nEatExp = 0; for (int i = 0; i < itemlist.Count; i++) { SwordsMan oSwordsMan = itemlist[i]; if (null == oSwordsMan) { LogModule.ErrorLog("OnLoadSwordsManItem::oSwordsMan is null"); break; } if (false == oSwordsMan.IsValid()) { continue; } SwordsManItem oSwordsManItem = SwordsManItem.CreateItem(m_SwordsManGrid, resObj, i.ToString(), this); if (null == oSwordsManItem) { LogModule.ErrorLog("OnLoadSwordsManItem::oSwordsManItem is null"); break; } oSwordsManItem.SetData(oSwordsMan); if (oSwordsMan.Guid == CurSwordsMan.Guid) { continue; } if (oSwordsMan.Quality > CurSwordsMan.Quality) { continue; } if (oSwordsMan.Locked) { continue; } oSwordsManItem.OnSelectSwordsMan(); m_nEatExp += oSwordsManItem.m_oSwordsMan.GetEatExp(); } m_SwordsManGrid.GetComponent <UIGrid>().repositionNow = true; if (m_TopGrid != null) { m_TopGrid.Recenter(true); } ShowSwordsManExp(); }