public void PutMonster() { // 获取卡片信息 CardInfo cardInfo = ShowCardInfo.getCardInfo(this.operateCardObj.GetComponent <ShowCardInfo>().cardId); if (cardInfo.starNum <= 4) { // 普通召唤 CallMonsterRequest(0); } else if (cardInfo.starNum > 4 && cardInfo.starNum <= 6) { // 一个祭品召唤 App.isOfferState = true; App.selectLimit = 1; App.handIdx = this.operateCardObj.transform.GetSiblingIndex(); App.monsterStatus = 0; Debug.Log("一个祭品召唤"); } else { // 两个祭品召唤 App.isOfferState = true; App.selectLimit = 2; App.handIdx = this.operateCardObj.transform.GetSiblingIndex(); App.monsterStatus = 0; Debug.Log("两个祭品召唤"); } closeMyself(); }
public void CallMonster() { // 获取卡片信息 CardInfo cardInfo = ShowCardInfo.getCardInfo(this.operateCardObj.GetComponent <ShowCardInfo>().cardId); if (cardInfo.starNum <= 4) { // 普通召唤 CallMonsterRequest(2); } else if (cardInfo.starNum > 4 && cardInfo.starNum <= 6) { if (existMyMonster()) { // 一个祭品召唤 App.isOfferState = true; App.selectLimit = 1; App.handIdx = this.operateCardObj.transform.GetSiblingIndex(); App.monsterStatus = 2; } else { MsgBox.showMsg("场上没有祭品"); } } else { if (existMyMonster()) { // 两个祭品召唤 App.isOfferState = true; App.selectLimit = 2; App.handIdx = this.operateCardObj.transform.GetSiblingIndex(); App.monsterStatus = 2; } else { MsgBox.showMsg("场上没有祭品"); } } closeMyself(); }
private void DoHandAdd(JsonData responseResult) { // 获取参数 string email = (string)responseResult["data"]["email"]; int cardId = (int)responseResult["data"]["paramsMap"]["CardId"]; GameObject desCardObj; GameObject handContentObj; if (email == UserInfo.email) { desCardObj = createCard(cardId, true); desCardObj.AddComponent <CardMenuScript>(); // 这里要做区分,判断是否是怪兽 // 获取卡片信息 CardInfo cardInfo = ShowCardInfo.getCardInfo(cardId); if (cardInfo.type.Contains("怪兽")) { desCardObj.GetComponent <CardMenuScript>().menuPrefab = Resources.Load <GameObject>("prefab/HandMonsterMenu"); } else if (cardInfo.type.Contains("魔法")) { desCardObj.GetComponent <CardMenuScript>().menuPrefab = Resources.Load <GameObject>("prefab/HandMagicMenu"); } else if (cardInfo.type.Contains("陷阱")) { desCardObj.GetComponent <CardMenuScript>().menuPrefab = Resources.Load <GameObject>("prefab/HandTrapMenu"); } desCardObj.GetComponent <CardMenuScript>().turnStates = new string[] { "M1P", "M2P" }; handContentObj = GameObject.Find("MHandPanel/Scroll View/Viewport/Content"); } else { desCardObj = createCard(-1, false); handContentObj = GameObject.Find("EHandPanel/Scroll View/Viewport/Content"); } desCardObj.transform.SetParent(handContentObj.transform); }