// 更新卡牌属性,这个主要更改卡牌经常改变的属性 public override void updateCardDataChangeBySvr(t_Card svrCard_ = null) { base.updateCardDataChangeBySvr(svrCard_); if (svrCard_ == null) { svrCard_ = m_sceneCardItem.svrCard; } AuxLabel text = new AuxLabel(); if (m_sceneCardItem != null) { if (m_sceneCardItem.cardArea == CardArea.CARDCELLTYPE_HAND) // 手牌不同更新 { text.setSelfGo(m_render.gameObject(), "UIRoot/AttText"); // 攻击 text.text = svrCard_.damage.ToString(); text.setSelfGo(m_render.gameObject(), "UIRoot/MpText"); // Magic text.text = svrCard_.mpcost.ToString(); text.setSelfGo(m_render.gameObject(), "UIRoot/HpText"); // HP text.text = svrCard_.hp.ToString(); } if (m_sceneCardItem.cardArea == CardArea.CARDCELLTYPE_COMMON) // 场牌更新 { text.setSelfGo(m_render.gameObject(), "UIRoot/AttText"); // 攻击 text.text = svrCard_.damage.ToString(); text.setSelfGo(m_render.gameObject(), "UIRoot/HpText"); // HP text.text = svrCard_.hp.ToString(); } } }
public void updateSceneCardBySvrData(t_Card mobject) { SceneCardItem sceneItem = null; sceneItem = Ctx.m_instance.m_dataPlayer.m_dzData.m_playerArr[(int)m_playerSide].updateCardInfoByCardItem(mobject); updateSceneCardByItem(sceneItem); }
public void addSceneCardBySvrData(t_Card mobject) { SceneCardItem sceneItem = null; // 填充数据 sceneItem = Ctx.m_instance.m_dataPlayer.m_dzData.m_playerArr[(int)m_playerSide].createCardItemBySvrData(m_playerSide, mobject); Ctx.m_instance.m_dataPlayer.m_dzData.m_playerArr[(int)m_playerSide].addOneSceneCard(sceneItem); // 添加数据 addSceneCardByItem(sceneItem); }
// 计算是否是伤血 protected bool hasDamageHp(t_Card src, t_Card dest) { if (src.hp > dest.hp) // HP 减少 { if (src.maxhp == dest.maxhp) // 不是由于技能导致的将这两个值减少并且设置成同样的值,就是伤血 { return(true); } } return(false); }
public override void serialize(ByteBuffer bu) { base.serialize(bu); bu.writeUnsignedInt8(slot); bu.writeUnsignedInt8(who); bu.writeUnsignedInt8(byActionType); mobject = new t_Card(); mobject.serialize(bu); //bu.writeUnsignedInt8(attackType); //bu.writeUnsignedInt32(pAttThisID); //bu.writeUnsignedInt32(pDefThisID); }
public override void derialize(ByteBuffer bu) { base.derialize(bu); bu.readUnsignedInt8(ref slot); bu.readUnsignedInt8(ref who); bu.readUnsignedInt8(ref byActionType); mobject = new t_Card(); mobject.derialize(bu); //bu.readUnsignedInt8(ref attackType); //bu.readUnsignedInt32(ref pAttThisID); //bu.readUnsignedInt32(ref pDefThisID); }
override public void updateCardDataChangeBySvr(t_Card svrCard_ = null) { base.updateCardDataChangeBySvr(); if (svrCard_ == null) { svrCard_ = m_sceneCardItem.svrCard; } AuxLabel text = new AuxLabel(); text.setSelfGo(m_render.gameObject(), "UIRoot/MpText"); // 消耗 text.text = svrCard_.mpcost.ToString(); }
public override void derialize(ByteBuffer bu) { base.derialize(bu); bu.readUnsignedInt32(ref dwMagicType); bu.readUnsignedInt8(ref type); bu.readUnsignedInt16(ref count); A_object = new t_Card(); A_object.derialize(bu); if (count > 0) { defList = new t_Card[count]; for (int idx = 0; idx < count; ++idx) { defList[idx] = new t_Card(); defList[idx].derialize(bu); } } }
override public void updateCardDataChangeBySvr(t_Card svrCard_ = null) { base.updateCardDataChangeBySvr(svrCard_); if (svrCard_ == null) { svrCard_ = m_sceneCardItem.svrCard; } AuxLabel text = new AuxLabel(); text.setSelfGo(m_render.gameObject(), "UIRoot/AttText"); // 攻击 text.text = svrCard_.damage.ToString(); text.setSelfGo(m_render.gameObject(), "UIRoot/HpText"); // HP text.text = svrCard_.hp.ToString(); text.setSelfGo(m_render.gameObject(), "UIRoot/ArmorText"); // Armor 护甲 text.text = svrCard_.armor.ToString(); updateHp(); }
public override void derialize(ByteBuffer bu) { base.derialize(bu); maincard = new t_Card(); maincard.derialize(bu); bu.readUnsignedInt8(ref opType); bu.readUnsignedInt16(ref count); int idx = 0; othercard = new t_Card[count]; t_Card cardItem; for (; idx < count; ++idx) { cardItem = new t_Card(); cardItem.derialize(bu); othercard[idx] = cardItem; } }
// Update is called once per frame void Update() { if (monsterAttackTime > 0.0f) { monsterAttackTime -= Time.deltaTime; } if (bulletTime > 0.0f) { bulletTime -= Time.deltaTime; } if (cTimer > 0.0f) { cTimer -= Time.deltaTime; if (cTimer <= 0.0f) { circle.gameObject.SetActive(false); cTimer = 0.0f; } } //HP of enemy if (Mathf.Abs(HP_enemy_now - HP_enemy) >= 5.0f) { if (HP_enemy_now > HP_enemy) { HP_enemy_now -= Time.deltaTime * HP_enemy_max / 3.0f; GameObject snd = (GameObject)Instantiate(HP_Down); Destroy(snd, 0.3f); } else { HP_enemy_now += Time.deltaTime * HP_enemy_max / 3.0f; GameObject snd = (GameObject)Instantiate(HP_Up); Destroy(snd, 0.3f); } if (Mathf.Abs(HP_enemy_now - HP_enemy) < 5.0f) { HP_enemy_now = HP_enemy; } } // HP of player if (Mathf.Abs(HP_player_now - HP_player) >= 5.0f) { if (HP_player_now > HP_player) { HP_player_now -= Time.deltaTime * HP_player_max / 3.0f; } else { HP_player_now += Time.deltaTime * HP_player_max / 3.0f; } if (Mathf.Abs(HP_player_now - HP_player) < 5.0f) { HP_player_now = HP_player; } } if (monsterCreateTime > 0.0f) { monsterCreateTime -= Time.deltaTime; } if (monsterCreateTime > 0.0f) { return; } if (monsterCreateTime < 0.0f) { monsterCreateTime = 0.0f; HP_initial(); } if (ui.isGameOver) { return; } if (ui.isSelectWord == 2) { if (isFireBall == false) { lastCount = 0; isFireBall = true; fireBallNum = ui.backWord.finishIndex; fireBalls = new GameObject[fireBallNum]; for (int i = 0; i < fireBallNum; i++) { fireBalls[i] = (GameObject)Instantiate(fireBall); if (i == 0) { fireBalls[i].transform.position = new Vector3(-0.2083941f, 35.57512f, 5.812185f); } else if (i % 2 != 0) { fireBalls[i].transform.position = fireBalls[0].transform.position - new Vector3((i + 1) / 2.0f * 3.0f, 0, 0); } else { fireBalls[i].transform.position = fireBalls[0].transform.position + new Vector3(i / 2.0f * 3.0f, 0, 0); } } } if (ui.frontWord.finishIndex > lastCount) { lastCount = ui.frontWord.finishIndex; Destroy(fireBalls[ui.backWord.finishIndex - lastCount]); } if (ui.frontWord.finishIndex >= ui.backWord.finishIndex) { ui.isSelectWord = 0; isFireBall = false; bulletNum = ui.frontWord.finishIndex; bulletTime = 0.15f; // store record to database ui.saveScore(); /* * bool isFind = false; * foreach(wordRecord word in ui.rcd.records) * { * if(word.word == firstWord.wordName) * { * isFind = true; * word.addRecord(ui.error, System.DateTime.Now.ToString()); * print(word.records.Count); * } * } * // this is a new word record * if(isFind == false) * { * ui.db.addRecord(new writeRecord(firstWord.wordName, ui.error, System.DateTime.Now.ToString())); * ui.rcd.wordRecord = ui.db.getRecords(); * }//*/ /*if(ui.db.isTerm(firstWord, secondWord)) * { * print("is Term!!"); * } * else * { * print("no Term!!"); * }*/ //print(firstWord.wordName + " " + secondWord.wordName); } } else { if (ui.isFight == false) { if (bulletNum > 0 && bulletTime < 0.0f) { Fight(); bulletTime = 0.15f; bulletNum--; } if (bulletNum == 0) { if (ui.db.isTerm(firstWord, secondWord)) { isTermAttack = true; monsterAttackTime = 2.8f; } else { monsterAttackTime = 1.6f; } ui.isFight = true; ui.ClearCanvas(); for (int i = 0; i < 4; i++) { //remainWordIdx[i] = -1; t_Card card = GameObject.Find("Card" + (i + 1).ToString()).GetComponent <t_Card>(); //if(card.isSelect) //{ card.anim.clip = card.anim.GetClip("RotationToNegative"); card.anim.Play(); //} //else // remainWordIdx[i] = ui.chooseWords[i]; } if (isRecover) { HP_player += (int)(ui.backWord.ATK); if (HP_player > HP_player_max) { HP_player = HP_player_max; } isRecover = false; } } } } if (HP_enemy > 0 && monsterAttackTime < 2.2f && monsterAttackTime != 0.0f) { if (ui.db.isTerm(firstWord, secondWord) && isTermAttack == true && Word.Judge(ui.showE) != "Fail") { isTermAttack = false; print("is Term!!"); Instantiate(Terms); } } if (HP_enemy > 0 && monsterAttackTime < 0.0f) { monsterAttackTime = 0.0f; GameObject bullet = (GameObject)Instantiate(Bullet, monster.transform.position - new Vector3(0, 0, 10), Quaternion.identity); bullet.GetComponent <t_Bullet>().attackObj = GameObject.Find("Canvas"); bullet.GetComponent <t_Bullet>().ATK = ATK_enemy; bullet.GetComponent <TrailRenderer>().time = 0.1f; bullet.GetComponent <TrailRenderer>().startWidth = 3.0f; bullet.GetComponent <TrailRenderer>().endWidth = 3.0f; //bullet.SetActive(false); bullet.renderer.enabled = false; } // Game over? if (HP_enemy == 0 && bulletNum == 0) { monsterAttackTime = 0.0f; monsterCreateTime = CreateTime; monster.renderer.material = mat_black_monster; HP_enemy = -1; HP_enemy_max += 200; ATK_enemy += 10; ui.levelNow += 1; ui.Initial(); } if (HP_player <= 0 || ui.levelNow > ui.levelNum) { // game over ui.isGameOver = true; AudioSource music = GameObject.Find("Global").GetComponent <AudioSource>(); music.Stop(); } }
public void derialize(ByteBuffer bu) { bu.readUnsignedInt8(ref who); mobject = new t_Card(); mobject.derialize(bu); }
override public void updateCardDataChangeBySvr(t_Card svrCard_ = null) { }
// 更新卡牌属性,这个主要更改卡牌经常改变的属性,除了初始卡牌,后来服务器发送过来的卡牌数据都要从这个刷新 public virtual void updateCardDataChangeBySvr(t_Card svrCard_ = null) { }