public Player(ActorType type, int id, int staticID, CSItemGuid guid) : base(type, id, staticID, guid) { if (type == ActorType.enSwitch) { SelfAI = new AISwitchPlayer(); SelfAI.Owner = this; Combo = BattleArena.Singleton.Combo; } else if (type == ActorType.enFollow) { SelfAI = new AIPartner(); SelfAI.Owner = this; Combo = null;//BattleArena.Singleton.Combo; WTF = new WillToFight(this); } else { SelfAI = new AIServerActor(); SelfAI.Owner = this; } m_defaultVelocity = 5.0f; Props = ENProperty.Singleton.CreatePropertySet("SOBPlayer"); SetPropertyObjectID((int)(MVCPropertyID.enActorStartID) + id); IDInTable = staticID; OnInitProps(); }
public void UpdateTeamBagAllSlotId() { CSItemGuid guid = new CSItemGuid(); CSItem card = GetCard(m_curTeamIndex, EDITTYPE.enMain); if (card == null) { m_bagMainSlotId = guid; } else { m_bagMainSlotId = card.Guid; } card = GetCard(m_curTeamIndex, EDITTYPE.enDeputy); if (card == null) { m_bagDeputySlotId = guid; } else { m_bagDeputySlotId = card.Guid; } card = GetCard(m_curTeamIndex, EDITTYPE.enSupport); if (card == null) { m_bagSupportSlotId = guid; } else { m_bagSupportSlotId = card.Guid; } }
public void SetCardCurt(CSItemGuid guid) { if (!guid.Equals(CSItemGuid.Zero)) { m_curDivisionCardGuid = guid; } }
public override int req_herocardMerge(CSItemGuid cardGUID, List <CSItemGuid> foodCards) { MessageBlock msg = MessageBlock.CreateMessage(GamePacketID.ENMsgHerocardMerge_C2S); msg.AddParam("heroCardGuid_lowPart", cardGUID.m_lowPart); msg.AddParam("heroCardGuid_highPart", cardGUID.m_highPart); for (int index = 0; index < 10; index++) { if (index >= foodCards.Count) { msg.AddParam("lowPart", 0); msg.AddParam("highPart", 0); } else { msg.AddParam("lowPart", foodCards[index].m_lowPart); msg.AddParam("highPart", foodCards[index].m_highPart); } } MessageTransfer.Singleton.SendMsg(msg); int msgID = msg.MessageID; MessageBlock.ReleaseMessage(msg); return(msgID); }
public void Test() { // 如果单机 if (GameSettings.Singleton.m_isSingle) { Team.Singleton.m_curTeamIndex = 0; CSItemGuid temp = new CSItemGuid(); temp.m_lowPart = 1; CSItemGuid temp1 = new CSItemGuid(); temp1.m_lowPart = 2; CSItemGuid temp2 = new CSItemGuid(); temp2.m_lowPart = 3; if (Team.Singleton.GetCard(0, Team.EDITTYPE.enMain) == null) { CardBag.Singleton.AddCardOffLine(4); Team.Singleton.AddTeamMember(0, Team.EDITTYPE.enMain, temp); } if (Team.Singleton.GetCard(0, Team.EDITTYPE.enDeputy) == null) { CardBag.Singleton.AddCardOffLine(5); Team.Singleton.AddTeamMember(0, Team.EDITTYPE.enDeputy, temp1); } // if (Team.Singleton.GetCard(0, Team.EDITTYPE.enSupport) == null) // { // CardBag.Singleton.AddCardOffLine(4); // Team.Singleton.AddTeamMember(0, Team.EDITTYPE.enSupport, temp2); // // } } }
// 设置要显示的 卡牌详情的卡牌数据 bOnlyCancel是否只显示 返回按钮 public void SetShowCardData(CSItem card, bool bOnlyCancel = false) { // 只带 返回按钮 if (bOnlyCancel) { m_curOptinGuid = CSItemGuid.Zero; } m_cardForDetail = card; }
public ControlTrap(int id, int staticID, CSItemGuid guid) : base(id, staticID, guid) { mTrapType = TrapType.enControl; mCloseTrapAnim = CurrentTableInfo.mCloseTrapAnim; mDisableAnim = CurrentTableInfo.mDisableTrapAnim; mOpenTrapAnim = CurrentTableInfo.mOpenTrapAnim; mLocalTrapAnim = CurrentTableInfo.mLockTrapAnim; }
// 更新卡牌界面相关信息 public void UpdateInfo(CSItemGuid guid) { CSItem cardInfo = CardBag.Singleton.itemBag.GetItemByGuid(guid); if (cardInfo == null) { return; } // 卡牌ID int id = cardInfo.IDInTable; HeroInfo info = GameTable.HeroInfoTableAsset.Lookup(id); if (null == info) { Debug.Log("UICard UpdateInfo HeroInfo 表数据没有 ID 为:" + id); return; } // 星级 SetRarity(info.Rarity); RarityRelativeInfo rarityInfo = GameTable.RarityRelativeAsset.LookUp(info.Rarity); if (null == rarityInfo) { Debug.Log("UICard UpdateInfo RarityRelativeInfo 表数据没有 ID 为:" + id); return; } IconInfomation imageInfo = GameTable.IconInfoTableAsset.Lookup(info.ImageId); if (null == imageInfo) { return; } // 消耗 m_cardCost.text = info.Cost.ToString(); m_cardName.text = info.StrName.ToString(); m_card.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(imageInfo.dirName); // 计算生命值 float hp = cardInfo.GetHp(); m_cardHp.text = hp.ToString(); // 计算物理攻击力 float attack = cardInfo.GetPhyAttack(); m_cardAttack.text = attack.ToString(); Debug.Log("UICard UpdateInfo:" + info.StrName); }
// 显示 卡牌晋级界面 public void OnShowCardEvolution(CSItemGuid guid) { if (!guid.Equals(CSItemGuid.Zero)) { m_curEvolutionGuid = guid; } NotifyChanged((int)ENPropertyChanged.enShowCardEvolution, null); }
void OnPropertyChanged(int objectID, int eventType, IPropertyObject obj, object eventObj) { Debug.Log("UICard OnPropertyChanged:" + eventType); if (eventType == (int)CardBag.ENPropertyChanged.enShowCard) { CSItemGuid guid = (CSItemGuid)eventObj; UpdateInfo(guid); ShowWindow(); } }
// 移除 升级 材料卡牌 选中的 道具 public void RemoveLevelUpDataItem(CSItemGuid guid) { CSItem item = CardBag.Singleton.GetCardByGuid(guid); HeroInfo info = GameTable.HeroInfoTableAsset.Lookup(item.IDInTable); UnityEngine.Debug.Log("RemoveLevelUpDataItem" + info.StrName); m_levelUpList.Remove(guid); }
public bool IsOnBody(CSItemGuid guid) { for (int index = 0; index < dress.Count(); index++) { if (guid == dress[index]) { return(true); } } return(false); }
public NPC(ActorType type, int id, int staticID, CSItemGuid guid) : base(type, id, staticID, guid) { IsActive = true; m_defaultVelocity = 4.0f; Props = ENProperty.Singleton.CreatePropertySet("SOBNpc"); SetPropertyObjectID((int)MVCPropertyID.enActorStartID + id); IDInTable = staticID; OnInitProps(); }
public void SetNewLevel(CSItemGuid id, int level, int exp, bool isBind) { foreach (KeyValuePair <CSItemGuid, CSOldItem> pair in m_equips) { if (pair.Value.m_guid == id) { pair.Value.Level = level; pair.Value.exp = exp; pair.Value.m_isBind = isBind; } } }
public override int req_setRepresentativeCard(CSItemGuid cardGUID) { MessageBlock msg = MessageBlock.CreateMessage(GamePacketID.ENMsgSetRepresentativeCard_C2S); msg.AddParam("heroCardGuid_lowPart", cardGUID.m_lowPart); msg.AddParam("heroCardGuid_highPart", cardGUID.m_highPart); MessageTransfer.Singleton.SendMsg(msg); int msgID = msg.MessageID; MessageBlock.ReleaseMessage(msg); return(msgID); }
static int Compare(CSItemGuid a, CSItemGuid b) { if (a.m_lowPart > b.m_lowPart) { return(1); } else if (a.m_lowPart < b.m_lowPart) { return(-1); } return(0); }
public MainPlayer(ActorType type, int id, int staticID, CSItemGuid guid) : base(type, id, staticID, guid) { ItemBag = new CSItemBag(); m_player.Owner = this; m_autoPlayer.Owner = this; SelfAI = m_player; SetPropertyObjectID((int)MVCPropertyID.enMainPlayer); Combo = BattleArena.Singleton.Combo; }
//脱装备 public void GetOff(CSItemGuid guid) { for (int index = 0; index < dress.Count(); index++) { if (guid == dress[index]) { CSItemGuid zero; zero.m_lowPart = 0; zero.m_highPart = 0; dress[index] = zero; } } }
public CSOldItem getEquipByInstId(CSItemGuid id) { CSOldItem obj = null; if (m_equips.TryGetValue(id, out obj)) { return(obj); } else { return(null); } }
//进化素材手否足够 public bool CardEvolutionFoodEnough(CSItemGuid itemGuid) { CSItem item = GetCardByGuid(itemGuid); if (item == null) { return(false); } HeroInfo info = GameTable.HeroInfoTableAsset.Lookup(item.IDInTable); if (info == null) { return(false); } //进化需要的卡牌id和数量 Dictionary <int, int> evolveCardList = new Dictionary <int, int>(); foreach (var cardID in info.EvolveCardList) { if (evolveCardList.ContainsKey(cardID)) { ++evolveCardList[cardID]; } else { evolveCardList[cardID] = 0; } } foreach (CSItem card in itemList) { if (item.Guid == card.Guid) { continue; } int cardID = card.IDInTable; if (evolveCardList.ContainsKey(cardID)) { evolveCardList[cardID]--; } } foreach (KeyValuePair <int, int> resultCount in evolveCardList) { int result = resultCount.Value; if (result > 0) { return(false); } } return(true); }
// index 队伍索引 type 类型 public CSItem GetCard(int index, EDITTYPE type) { foreach (TeamItem item in m_teamList) { if (item.m_index == index) { CSItemGuid guid = item.m_memberList[(int)type]; return(CardBag.Singleton.GetCardByGuid(guid)); } } return(null); }
public int GetItemSlotByGuid(CSItemGuid guid) { int count = m_items.Count; for (int i = 0; i < count; i++) { CSItem item = m_items[i]; if (item.m_guid == guid) { return(i); } } return(-1); }
public CSItem GetItemByGuid(CSItemGuid guid) { int count = m_items.Count; for (int i = 0; i < count; i++) { CSItem item = m_items[i]; if (item.m_guid == guid) { return(item); } } return(null); }
public void RemoveItem(CSItemGuid guid) { int count = m_items.Count; for (int i = 0; i < count; i++) { CSItem item = m_items[i]; if (item.m_guid == guid) { m_items.Remove(item); return; } } }
public override bool Equals(object obj) { if (null == obj) { return(false); } if (obj.GetType() != this.GetType()) { return(false); } CSItemGuid other = (CSItemGuid)obj; return(this == other); }
public override int herocard_addExp(CSItemGuid cardGUID, int exp) { MessageBlock msg = MessageBlock.CreateMessage(GamePacketID.ENMsgHerocardAddexp_C2S); msg.AddParam("heroCardGuid_lowPart", cardGUID.m_lowPart); msg.AddParam("heroCardGuid_highPart", cardGUID.m_highPart); msg.AddParam("exp", exp); MessageTransfer.Singleton.SendMsg(msg); int msgID = msg.MessageID; MessageBlock.ReleaseMessage(msg); return(msgID); }
// 添加 升级 材料卡牌 选中的 道具 public void AddLevelUpDataItem(CSItemGuid guid) { // 如果大于10 则不添加 if (m_levelUpList.Count >= 10) { return; } // 如果不存在则添加 if (-1 == m_levelUpList.IndexOf(guid)) { m_levelUpList.Add(guid); } }
// 更新卡牌界面相关信息 public void UpdateInfo(CSItemGuid guid) { CSItem card = CardBag.Singleton.GetCardByGuid(guid); if (null == card) { return; } m_name.text = ""; HeroInfo info = GameTable.HeroInfoTableAsset.Lookup(card.IDInTable); if (null == info) { Debug.Log("UICard UpdateInfo HeroInfo 表数据没有 ID 为:" + card.IDInTable); return; } IconInfomation imageInfo = GameTable.IconInfoTableAsset.Lookup(info.ImageId); if (null == imageInfo) { return; } m_card.mainTexture = PoolManager.Singleton.LoadIcon<Texture>(imageInfo.dirName); m_name.text = info.StrName; m_attirbutename.name = info.StrName; // 星级 RarityRelativeInfo rarityInfo = GameTable.RarityRelativeAsset.LookUp(info.Rarity); if (null == rarityInfo) { return; } IconInfomation icon = GameTable.IconInfoTableAsset.Lookup(rarityInfo.m_iconId); m_cardRarity.GetComponent<UITexture>().mainTexture = PoolManager.Singleton.LoadIcon<Texture>(icon.dirName); // 消耗 m_cardCost.text = info.Cost.ToString(); // 生命值 m_cardHp.text = card.GetHp().ToString(); m_magAttack.text = card.GetMagAttack().ToString(); m_cardAttack.text = card.GetPhyAttack().ToString(); }
// 显示 单个队伍编辑的卡牌列表 public void SetOperateTeamType() { CSItem oldOne = Team.Singleton.GetCard(Team.Singleton.m_curTeamIndex, Team.Singleton.m_curEditType); if (oldOne == null) { m_oldTeamMember = CSItemGuid.Zero; } else { m_oldTeamMember = oldOne.Guid; } m_curType = TYPE.enTeamCardListType; }
void RefreshShowProps() { string name = User.Singleton.UserProps.GetProperty_String(UserProperty.name); int level = User.Singleton.UserProps.GetProperty_Int32(UserProperty.level); int exp = User.Singleton.UserProps.GetProperty_Int32(UserProperty.exp); int maxExp = GameTable.playerAttrTableAsset.LookUp(level).m_needExp; int money = User.Singleton.UserProps.GetProperty_Int32(UserProperty.money); CSItemGuid guid = User.Singleton.RepresentativeCard; SetPortraitGUID(guid); SetName(name); SetExp(exp, maxExp, showPercent); SetLevel(level); SetMoney(money); }