Example #1
0
    private bool CreateGoodsHandle(CReadPacket packet)
    {
        GameLibrary.Instance().PackedCount++;

        if (GameLibrary.Instance().PackedCount > 1)
        {
            return(false);
        }
        Debug.Log("<color=#FFc937>CreateGoodsHandle抽奖数据</color>");
        //bug.Log(" <color=#FF4040>Lottery ResultGood</color>");
        Dictionary <string, object> data = packet.data;


        int result = int.Parse(data["ret"].ToString());

        if (result == 0)
        {
            Singleton <LotteryResultManager> .Instance.LotteryHandler(data);
        }
        else
        {
            Debug.Log(string.Format("获取商店物品列表失败:{0}", data["desc"].ToString()));
            return(false);
        }
        return(true);
    }
Example #2
0
 void Update()
 {
     if (attackerCs != null && (attackerCs.isDie || (!GameLibrary.Instance().CanControlSwitch(attackerCs.pm) && isHitAction)))
     {
         Destroy(gameObject);
     }
 }
Example #3
0
    protected override void ShowHandler()
    {
        if (showList.Count > 0)
        {
            isShow = true;
            int heroId = int.Parse(201 + StringUtil.SubString(showList[0].ToString(), 6, 3));
            if (FSDataNodeTable <HeroNode> .GetSingleton().DataNodeList.ContainsKey(heroId))
            {
                int startId = FSDataNodeTable <HeroNode> .GetSingleton().DataNodeList[heroId].init_star;

                count = FSDataNodeTable <StarUpGradeNode> .GetSingleton().DataNodeList[startId].convert_stone_num;
            }
            string a  = StringUtil.SubString(showList[0].ToString(), 6, 3);
            int    id = int.Parse(106 + StringUtil.SubString(showList[0].ToString(), 6, 3));
            vo         = GameLibrary.Instance().ItemStateList[id];
            label.text = "您已经拥有此英雄,故赠送您" + count + "个" + vo.name;
            //  Debug.Log(label.text + "      ");
            sprite.spriteName = vo.icon_name;
            // StartCoroutine(DelayTime());
            //GoodsDataOperation.GetInstance().AddGoods(id,count);
        }
        else
        {
            Hide();
            Control.HideGUI(this.GetUIKey());
        }
    }
Example #4
0
 private void GetSkillNodeByStateInfo(AnimatorStateInfo stateInfo)
 {
     if (mCurSkillNode == null)
     {
         skillIndex = 0;
         int mCurHash = stateInfo.fullPathHash;
         if (mCurHash == pm.Skill1_Hash)
         {
             skillIndex = 1;
         }
         else if (mCurHash == pm.Skill2_Hash)
         {
             skillIndex = 2;
         }
         else if (mCurHash == pm.Skill3_Hash)
         {
             skillIndex = 3;
         }
         else if (mCurHash == pm.Skill4_Hash)
         {
             skillIndex = 4;
         }
         mCurSkillNode = GameLibrary.Instance().GetCurrentSkillNodeByCs(cs, skillIndex);
     }
 }
Example #5
0
    private bool ShowHotHandle(CReadPacket packet)
    {
        Debug.Log("<color=#FFc937>Lottery HotResult抽奖每日热点</color>");
        Dictionary <string, object> data = packet.data;

        int result = int.Parse(data["ret"].ToString());

        if (result == 0)
        {
            if (data.ContainsKey("item"))
            {
                if (null != data["item"])
                {
                    int[] goodList = data["item"] as int[];
                    playerData.GetInstance().lotteryInfo.diamondDrawCounnt = int.Parse(data["dd"].ToString());
                    playerData.GetInstance().lotteryInfo.goldDrawCount = int.Parse(data["gd"].ToString());
                    playerData.GetInstance().lotteryInfo.diamondTime = long.Parse(data["ddt"].ToString());
                    playerData.GetInstance().lotteryInfo.goldTime = long.Parse(data["gdt"].ToString());
                    for (int i = 0; i < goodList.Length; i++)
                    {
                        ItemData itemInfo = new ItemData();
                        itemInfo.Id = int.Parse(goodList[i].ToString());
                        ItemNodeState vo = GameLibrary.Instance().ItemStateList[itemInfo.Id];
                        itemInfo.Name     = vo.name;
                        itemInfo.Describe = vo.describe;
                        itemInfo.IconName = vo.icon_name;
                        switch (vo.grade)
                        {
                        case 1:
                            itemInfo.GradeTYPE = GradeType.Gray;
                            break;

                        case 2:
                            itemInfo.GradeTYPE = GradeType.Green;
                            break;

                        case 4:
                            itemInfo.GradeTYPE = GradeType.Blue;
                            break;

                        case 7:
                            itemInfo.GradeTYPE = GradeType.Purple;
                            break;

                        case 11:
                            itemInfo.GradeTYPE = GradeType.Orange;
                            break;

                        case 16:
                            itemInfo.GradeTYPE = GradeType.Red;
                            break;
                        }
                        playerData.GetInstance().lotteryInfo.hotList.Add(itemInfo);
                    }
                    //Control.ShowGUI(GameLibrary.UI_Lottery);
                }
            }
        }
        return(true);
    }
Example #6
0
    public bool CreateRoleResultHandle(CReadPacket packet)
    {
        Debug.Log("Login result");
        int resolt = packet.GetInt("ret");

        if (resolt == 0)
        {
            if (GameLibrary.Instance().isReconect)//如果断线重连状态不用接去数据
            {
                return(true);
            }
            playerData.GetInstance().selfData.changeCount = 0;
            HandleLoginPacketData(packet);
            //UICreateRole.instance.DestoryObj();
            if (Globe.isFightGuide)
            {
                SceneNewbieGuide.instance.CreateNameOver();
            }
        }
        else
        {
            HandleLoginFailed(packet);
        }
        return(true);
    }
Example #7
0
    void GetSoul()
    {
        int id = int.Parse(106 + StringUtil.SubString(mID.ToString(), 6, 3));

        vo   = GameLibrary.Instance().ItemStateList[id];
        mDes = "您已经拥有此英雄,故赠送您[2dd740]" + mCount + "个[-][9c35fe]" + vo.name;
    }
Example #8
0
    /// <summary>
    /// 长按持续吃药水
    /// </summary>
    /// <param name="go"></param>
    /// <param name="state"></param>
    private void OnPressIconClick(GameObject go, bool state)
    {
        Globe.selectHero = heroVo;
        heroData         = playerData.GetInstance().GetHeroDataByID(Globe.selectHero.hero_id);
        if (state)
        {
            //isContinued = true;
            //Invoke("OnMedicine", 1);

            InvokeRepeating("EatDrug", 1, userRate);
        }
        else
        {
            //Debug.LogError(state);
            //isContinued = false;
            //CancelInvoke("OnMedicine");
            CancelInvoke("EatDrug");
            //长按松开的时候 才向服务器发送信息
            if (useCount != 0)
            {
                ItemNodeState itemnodestate = null;
                if (GameLibrary.Instance().ItemStateList.ContainsKey(GoodsDetials.instance.currentSItemData.Id))
                {
                    itemnodestate = GameLibrary.Instance().ItemStateList[GoodsDetials.instance.currentSItemData.Id];
                    //ClientSendDataMgr.GetSingle().GetHeroSend().SendDrugUpgrade(heroData.id, FSDataNodeTable<ItemNode>.GetSingleton().FindDataByType(GoodsDetials.instance.currentSItemData.Id).props_id, useCount, upGradelvl);
                    //ClientSendDataMgr.GetSingle().GetHeroSend().SendDrugUpgrade(heroData.id, itemnodestate.props_id, useCount, upGradelvl);
                    GoodsDataOperation.GetInstance().UseGoods((int)GoodsDetials.instance.currentSItemData.Id, useCount);
                }
            }
            upGradelvl = 0;
            useCount   = 0;
        }
    }
Example #9
0
    private void GeEquipStrengthArr()
    {
        //当前装备
        ItemNodeState item = GameLibrary.Instance().ItemStateList[equipData.id];
        //基础装备
        long          baseid   = equipData.id / 100 * 100;
        ItemNodeState baseItem = GameLibrary.Instance().ItemStateList[baseid];

        short[] basepropertys = baseItem.propertylist;
        short[] propertys     = item.propertylist;
        if (basepropertys == null)
        {
            return;
        }
        int    index          = 0;
        string name           = "";
        string currentattrstr = "";
        string nextlvattrstr  = "";

        for (int i = 0; i < basepropertys.Length; i++)
        {
            if (basepropertys[i] > 0)
            {
                name           += propertyname[i] + "\n";
                currentattrstr += (basepropertys[i] + propertys[i] * equipData.level).ToString() + "\n";
                nextlvattrstr  += "+ " + propertys[i].ToString() + "\n";
            }
        }
        nameLabel.text        = name;
        currentattrLabel.text = currentattrstr;
    }
Example #10
0
    //控制技能
    public void ControllSkill()
    {
        if (controlState != GameLibrary.Instance().CanControlSwitch(thisCs.pm))
        {
            controlState = GameLibrary.Instance().CanControlSwitch(thisCs.pm);
        }
        if (thisCs.attackTarget == null || !GameLibrary.Instance().CanControlSwitch(thisCs.pm))
        {
            return;
        }
        float            dis    = Vector3.Distance(transform.position, thisCs.attackTarget.transform.position);
        List <SkillNode> skills = GetSkillsCanUse(skillsCDOver, (SkillNode node) =>
        {
            return(!node.IsControl());
        });

        if (CanSkill() && skills.Count > 0)
        {
            List <SkillNode> skillsInRange = GetSkillsCanUse(skills, (SkillNode node) => { return(node.dist > dis || node.dist == 0); }, new SkillSiteComparer());
            if (skillsInRange.Count > 0)
            {
                UseSkill(skillsInRange[0]);
            }
            else
            {
                thisCs.pm.Approaching(thisCs.attackTarget.transform.position);
            }
        }
    }
Example #11
0
    void initComb(long id)
    {
        if (id == 0)
        {
            return;
        }
        ItemNodeState selectMaterial = GameLibrary.Instance().ItemStateList[id];

        if (selectMaterial.syn_condition.Length > 0)
        {
            //   if(selec)
            if (!EquipDevelop.GetSingolton().equipIntensifyDlg.equipCompoundPanel.gameObject.activeSelf)
            {
                EquipDevelop.GetSingolton().equipIntensifyDlg.equipCompoundPanel.gameObject.SetActive(true);
            }
            // EquipDevelop.GetSingolton().equipIntensifyDlg.equipCompoundPanel.InitData(selectMaterial);
            EquipDevelop.GetSingolton().equipIntensifyDlg.SetIntersifyData(EquipDevelop.GetSingolton().checkIndex + 1, id);
            gameObject.SetActive(false);
        }
        else
        {
            //UIGoodsGetWayPanel.Instance.SetID(id);
            //if (UILevel.instance.GetLevelData())
            //{
            //    Control.ShowGUI(GameLibrary.UIGoodsGetWayPanel);
            //}
            Control.ShowGUI(UIPanleID.UIGoodsGetWayPanel, EnumOpenUIType.DefaultUIOrSecond, false, id);
            //出处面板   drop_fb 掉落副本的列表
        }
    }
Example #12
0
 private void OnReduceBtnClick()
 {
     string[] textColumn = saleCount.text.Split("/".ToCharArray());
     currentCount = Int32.Parse(textColumn[0]);
     //if (currentCount > 1)
     //{
     //    saleCount.text = (--currentCount) + "/" + equipItem.conut;
     //    totalPrice.text = currentCount * equipItem.saleprice + "";
     //}
     //else
     //{
     //    totalPrice.text = currentCount * equipItem.saleprice + "";
     //    return;
     //}
     if (GameLibrary.Instance().ItemStateList.ContainsKey(equipItem.Id))
     {
         if (currentCount > 1)
         {
             saleCount.text     = (--currentCount) + "/" + maxCount;
             totalExpValue.text = currentCount * GameLibrary.Instance().ItemStateList[equipItem.Id].power_add + "";
         }
         else
         {
             totalExpValue.text = currentCount * GameLibrary.Instance().ItemStateList[equipItem.Id].power_add + "";
             return;
         }
     }
 }
Example #13
0
    public void InitData(EquipData equipData)
    {
        ed         = equipData;
        itemarr[0] = GameLibrary.Instance().ItemStateList[ed.id];

        equipstepfram[0].spriteName = UISign_in.GetspriteName(ed.grade);
        // equipstepicon[0].spriteName = itemarr[0].icon_name;
        equipstepbutton[0].spriteName  = itemarr[0].icon_name;
        select.transform.parent        = equipstepfram[0].transform;
        select.transform.localPosition = Vector3.zero;

        equipLv[0].text = ed.level + "级";

        for (int i = 1; i < 4; i++)
        {
            equipstepfram[i].gameObject.SetActive(false);
        }

        if (!evolveDlg.gameObject.activeSelf)
        {
            evolveDlg.gameObject.SetActive(true);
            equipCompoundPanel.gameObject.SetActive(false);
        }
        evolveDlg.InitData(ed);
    }
Example #14
0
    /// <summary>
    /// 更新材料信息
    /// </summary>
    public void UpdateMatInfo()
    {
        itemmatl.Clear();

        needMatDic.Clear();

        //if (null == itemNode || itemNode.syn_condition[0, 0] == 0) return;

        List <long> itemList = new List <long>();

        ItemNodeState itemA = null;

        if (!GameLibrary.Instance().ItemStateList.TryGetValue(itemNode.props_id + 1, out itemA))
        {
            return;
        }

        //需要材料
        for (int i = 0; i < (itemA.syn_condition.Length / 2); i++)
        {
            for (int j = 0; j < 2; j++)
            {
                matsb.Append(itemA.syn_condition[i, j] + ",");
            }
        }

        string needMat = matsb.ToString();

        string[] needMats = needMat.Split(',');

        matsb.Length = 0;

        for (int i = 0; i < needMats.Length - 1; i += 2)
        {
            //当字典中不存在时加入字典
            if (!needMatDic.ContainsKey(long.Parse(needMats[i])))
            {
                needMatDic.Add(long.Parse(needMats[i]), int.Parse(needMats[i + 1]));
            }

            if (!itemList.Contains(long.Parse(needMats[i])))
            {
                itemList.Add(long.Parse(needMats[i]));
            }
        }

        object[] objMa = new object[itemList.Count];

        ItemNodeState itemNodeS;

        for (int i = 0; i < itemList.Count; i++)
        {
            GameLibrary.Instance().ItemStateList.TryGetValue(itemList[i], out itemNodeS);
            objMa[i] = itemNodeS;
        }

        matMultList.InSize(needMats.Length / 2, 5);
        matMultList.Info(objMa);
        evolutionBtn.text = "进化";
    }
Example #15
0
    //合成
    void EquipCompoundOnClick()
    {
        int  needcount = GameLibrary.Instance().ItemStateList[propid].syn_condition.Length / 2;
        long itemid;
        int  itemcount;
        bool isenable = true;

        for (int i = 0; i < needcount; i++)
        {
            itemid    = GameLibrary.Instance().ItemStateList[propid].syn_condition[i, 0];
            itemcount = (int)GameLibrary.Instance().ItemStateList[propid].syn_condition[i, 1];
            if (GoodsDataOperation.GetInstance().GetItemCountById(itemid) < itemcount)
            {
                isenable = false;
                break;
            }
        }
        if (isenable)
        {
            ClientSendDataMgr.GetSingle().GetHeroSend().SendHeroECom(propid, 1);
        }
        else
        {
            Control.ShowGUI(UIPanleID.UITooltips, EnumOpenUIType.DefaultUIOrSecond, false, "材料不足.");
        }
    }
Example #16
0
    public SkillBuff AddBuffTo(SkillBuff sBuff, CharacterState cs, CharacterState attackerCS, SkillNode skillNode, int lvl, bool needCheck)
    {
        List <CharacterState> keys = new List <CharacterState>(CharBuffs.Keys);

        for (int i = keys.Count - 1; i >= 0; i--)
        {
            if (keys [i] == null)
            {
                CharBuffs.Remove(keys[i]);
            }
        }
        if (CheckCanAdd(sBuff, cs, attackerCS) || !needCheck)
        {
            if (CharBuffs.ContainsKey(cs))
            {
                CharBuffs[cs].Add(sBuff);
            }
            else
            {
                List <SkillBuff> buffs = new List <SkillBuff>();
                buffs.Add(sBuff);
                CharBuffs.Add(cs, buffs);
            }
            sBuff.target   = cs;
            sBuff.attacker = attackerCS;
            sBuff.SetBuffSkillNode(skillNode, lvl);
            sBuff.showHud = GameLibrary.Instance().ShouldShowHud(cs, attackerCS);
            sBuff.Init();
            AddCalculateCurTargetProp(cs, sBuff);
            //sBuff.Excute(cs);
            cs.OnDead += (CharacterState mcs) => RemoveCalculateCurTargetProp(mcs, sBuff);
            return(sBuff);
        }
        return(null);
    }
Example #17
0
    public override void Info(object obj)
    {
        item = (ItemData)obj;
        if (null != obj)
        {
            icon.spriteName = item.IconName;

            count.text        = ((ItemData)obj).Count.ToString();
            sprite.spriteName = ItemData.GetFrameByGradeType(item.GradeTYPE);
            if (GameLibrary.Instance().ItemStateList.ContainsKey(item.Id))
            {
                value.text = "+" + GameLibrary.Instance().ItemStateList[item.Id].exp_gain + "经验";
            }

            if (item.Types == 6 || item.Types == 3)
            {
                debris.gameObject.SetActive(true);
            }
            else
            {
                debris.gameObject.SetActive(false);
            }
            if (item.Types == 3)
            {
                debris.GetComponent <UISprite>().spriteName = "materialdebris";
                debris.GetComponent <UISprite>().MakePixelPerfect();
            }
            else if (item.Types == 6)
            {
                debris.GetComponent <UISprite>().spriteName = "linghunshi";
                debris.GetComponent <UISprite>().MakePixelPerfect();
            }
            icon.uiAtlas = item.UiAtlas;
        }
    }
Example #18
0
 bool CheckCanAdd(SkillBuff sBuff, CharacterState cs, CharacterState attackerCS)
 {
     if (attackerCS == null)
     {
         return(cs.RecieveControl);
     }
     if (attackerCS.groupIndex != cs.groupIndex)
     {
         if (cs.RecieveControl)
         {
             if (GameLibrary.Instance().CheckNotHeroBoss(cs))
             {
                 return((sBuff.node.type == BuffType.decrease || sBuff.node.type == BuffType.continuousDecrease || sBuff.node.type == BuffType.DelayEffective) && sBuff.id != (long)SkillBuffType.Slow);
             }
             else
             {
                 return(sBuff.node.type == BuffType.control || sBuff.node.type == BuffType.decrease || sBuff.node.type == BuffType.translate || sBuff.node.type == BuffType.continuousDecrease || sBuff.node.type == BuffType.DelayEffective);
             }
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(sBuff.node.type == BuffType.increase || sBuff.node.type == BuffType.immune || sBuff.node.type == BuffType.other || sBuff.node.type == BuffType.continuousIncrease || sBuff.node.type == BuffType.talent || sBuff.node.type == BuffType.Summon);
     }
 }
Example #19
0
 void FixedUpdate()
 {
     if (GameLibrary.isBossChuChang)
     {
         return;
     }
     if (!GameLibrary.Instance().CanControlSwitch(thisCs.pm))
     {
         thisCs.pm.Stop();
         return;
     }
     targetCs = GetAttackTarget(thisCs.TargetRange);
     thisCs.SetAttackTargetTo(targetCs);
     if (isAttack && targetCs != null)
     {
         if (!aiSkillHandler.NormalAISkill())
         {
             aiSkillHandler.NormalAttack();
         }
     }
     else
     {
         PathFinding();
     }
 }
Example #20
0
    IEnumerator FlopAnim(FlopItem flopItem)
    {
        yield return(new WaitForSeconds(0.1f));

        PressEffect.SetActive(true);
        BattleUtil.PlayParticleSystems(PressEffect);
        yield return(new WaitForSeconds(1f));

        Anim1.enabled = true;
        SpLight.gameObject.SetActive(true);
        if (GameLibrary.Instance().ItemStateList.ContainsKey(flopItem.itemId))
        {
            ItemNodeState item = GameLibrary.Instance().ItemStateList[flopItem.itemId];

            Num.text        = flopItem.num.ToString();
            Name.text       = item.name;
            Icon.spriteName = item.icon_name;
            if (item.types == 6)
            {
                Icon.atlas       = ResourceManager.Instance().GetUIAtlas("UIHeroHead");
                SpTypeIcon.alpha = 1;
            }
            else
            {
                Icon.atlas       = ResourceManager.Instance().GetUIAtlas("Prop");
                SpTypeIcon.alpha = 0;
            }
            Frame.spriteName = ItemData.GetFrameByGradeType((GradeType)item.grade);
        }
    }
Example #21
0
 void MI2Click(int index)
 {
     for (int i = 0; i < HeroAndEquipNodeData.INSlist.Count; i++)
     {
         if (index == i)
         {
             if (HeroAndEquipNodeData.INSlist[i].syn_condition.Length > 0)
             {
                 Debug.Log(HeroAndEquipNodeData.INSlist[i].props_id);
                 Debug.Log(GameLibrary.Instance().ItemStateList[HeroAndEquipNodeData.INSlist[i].props_id].syn_condition.Length);
                 if (GameLibrary.Instance().ItemStateList[GameLibrary.Instance().ItemStateList[HeroAndEquipNodeData.INSlist[i].props_id].syn_condition[0, 0]].syn_condition.Length > 0)
                 {
                     SetCompoundData(MI2[i], MI2[i].INS.props_id);
                 }
                 else
                 {
                     Control.ShowGUI(UIPanleID.UITooltips, EnumOpenUIType.DefaultUIOrSecond, false, "没有可合成的材料.");
                 }
             }
             else
             {
                 Control.ShowGUI(UIPanleID.UITooltips, EnumOpenUIType.DefaultUIOrSecond, false, "没有可合成的材料.");
             }
         }
     }
 }
Example #22
0
    public void RefreshBuyUI(PromptType type, SceneNode sn)
    {
        gameObject.SetActive(true);
        this.type  = type;
        this.sn    = sn;
        moneyCount = playerData.GetInstance().GetMyMoneyByType(MoneyType.Diamond);
        if (type == PromptType.Buy)
        {
            ItemNodeState item = GameLibrary.Instance().ItemStateList[110000100];
            for (int i = 0; i < item.cprice.Length; i++)
            {
                if (item.cprice[i] != 0)
                {
                    needCount = item.cprice[i];
                    break;
                }
            }
            des.text = "花费" + (buyCount * needCount) + "钻石购买" + buyCount + "个扫荡卷";
            UnityUtil.SetBtnState(buyBtn.gameObject, true);
        }
        else if (type == PromptType.WarTimes)
        {
            ResetLaterNode node = FSDataNodeTable <ResetLaterNode> .GetSingleton().FindDataByType(1);//GameLibrary.mapElite[sn.SceneId][1]

            int reset = GameLibrary.mapElite[sn.SceneId][1] >= node.resetStage.Length - 1 ? node.resetStage.Length - 1 : GameLibrary.mapElite[sn.SceneId][1];
            resetDiamond = node.resetStage[reset];
            des.text     = "花费" + resetDiamond + "钻石购买" + 3 + "次征战";
            UnityUtil.SetBtnState(buyBtn.gameObject, true);
        }
        else
        {
            des.text = "钻石不足,去充值";
            UnityUtil.SetBtnState(buyBtn.gameObject, false);
        }
    }
Example #23
0
    protected override void OnFixedUpdate()
    {
        if (!GameLibrary.Instance().CanControlSwitch(thisCs.pm))
        {
            thisCs.pm.Stop();
            return;
        }
        CharacterState minHpCS = GetMinHpCS();

        thisCs.SetAttackTargetTo(minHpCS);//GetAttackTarget(thisCs.TargetRange)
        if (thisCs.attackTarget != null)
        {
            //float dis = Vector3.Distance(transform.position, minHpCS.transform.position);
            //List<SkillNode> skillsCanUse = aiSkillHandler.GetSkillsCanUse(aiSkillHandler.skillsCDOver, (SkillNode node) => { return (node.dist > dis || node.dist == 0); }, new SkillOrderComparer());
            //if (skillsCanUse.Count > 0 && aiSkillHandler.CanSkill())
            //    aiSkillHandler.UseSkill(skillsCanUse[0]);
            //else
            //    aiSkillHandler.NormalAttack();
            // aiSkillHandler.NormalAISkill(new SkillOrderComparer());
            if (!aiSkillHandler.NormalAISkill(new SkillOrderComparer()))
            {
                aiSkillHandler.NormalAttack();
            }
        }
        else if (minHpCS != null && !BattleUtil.ReachPos(thisCs.transform.position, minHpCS.transform.position, thisCs.TargetRange))
        {
            thisCs.pm.Approaching(minHpCS.transform.position);
        }
        else
        {
            thisCs.pm.Stop();
        }
    }
Example #24
0
 void Awake()
 {
     GameLibrary.playerstate = 0;//重置为游戏状态
     instance = this;
     //获取当前场景名字
     mCurActiveSceneName = SceneManager.GetActiveScene().name;
     //创建人物后 添加任务自动寻路脚本
     if (transform.gameObject.GetComponent <TaskAutoTraceManager>() == null)
     {
         transform.gameObject.AddComponent <TaskAutoTraceManager>();
     }
     if (stateobj == null)
     {
         stateobj = Resources.Load <GameObject>("Prefab/UIPanel/" + "NpcTaskState") as GameObject;
     }
     if (headtipobj == null)
     {
         headtipobj = Resources.Load <GameObject>("Prefab/UIPanel/" + "NpcHeadTip") as GameObject;
     }
     if (GameLibrary.Instance().CheckSceneNeedSync(mCurActiveSceneName) && CreatePeople.GetInstance() != null &&
         transform.parent != null && CreatePeople.GetInstance().transform.localPosition != Vector3.zero)
     {
         CreatePeople.GetInstance().transform.localPosition = transform.parent.localPosition;
     }
 }
Example #25
0
 public override void Hit()
 {
     if ((!cs.isDie && GameLibrary.Instance().CanControlSwitch(this) && CheckCanHitTag(transform) && !GameLibrary.isMoba))
     {
         base.Hit();
         Stop();
     }
 }
Example #26
0
    public override void Excute(CharacterState cs, float mCurValue)
    {
        base.Excute(cs, mCurValue);
        int     hpResult = GameLibrary.Instance().CalcSkillDamage(mCurValue, node.damageType, lvl, target, attacker);
        HUDType mCurType = attacker.state == Modestatus.Player ? HUDType.DamagePlayer : HUDType.DamageEnemy;

        cs.Hp(hpResult < 1 ? 1 : hpResult, mCurType, true, attacker);
    }
Example #27
0
 public virtual void DoEffect(int c, long cid)
 {
     if (target != null && !target.isDie)
     {
         int hpResult = GameLibrary.Instance().CalcSkillDamage(baseValue, node.damageType, lvl, target, attacker);
         target.Hp(hpResult, target.state == Modestatus.Player ? HUDType.DamagePlayer : HUDType.DamageEnemy, showHud);
     }
 }
Example #28
0
 public void InitShow()
 {
     icon.spriteName      = GameLibrary.Instance().ItemStateList[id].icon_name;
     nameTxt.text         = "购买" + GameLibrary.Instance().ItemStateList[id].name;
     quality.spriteName   = ItemData.GetFrameByGradeType((GradeType)(GameLibrary.Instance().ItemStateList[id].grade));
     leftDiamondTxt.text  = leftDiamondPrice.ToString();
     rightDiamondTxt.text = (rightDiamondPrice).ToString();
 }
Example #29
0
    /// <summary>
    /// 经验条滚动
    /// </summary>
    void OnSecondFunction()
    {
        exp -= 1;
        counts++;

        //更新经验条信息
        expSlider.value = 1f * counts / heroData.maxExps;
        expLabel.text   = Mathf.CeilToInt((1f * counts / heroData.maxExps) * heroData.maxExps) + "/" + heroData.maxExps;
        levelLabel.text = "Lv." + heroData.lvl;

        if ((1f * counts / heroData.maxExps) >= 1f)
        {
            counts = 0;


            heroData.lvl++;
            upGradelvl++;
            //heroData.maxExps = FSDataNodeTable<HeroUpGradeNode>.GetSingleton().FindDataByType(heroData.lvl).exp;
            heroData.maxExps = VOManager.Instance().GetCSV <HeroUpgradeCSV>("HeroUpgrade").GetVO(heroData.lvl).exp;
            expSlider.value  = 0;
            expLabel.text    = exp + "/" + heroData.maxExps;
            levelLabel.text  = "Lv." + heroData.lvl;

            if (heroData.lvl >= playerData.GetInstance().selfData.level)
            {
                heroData.exps = 0;

                expSlider.value = 0;
                expLabel.text   = heroData.exps + "/" + heroData.maxExps;
                levelLabel.text = "Lv." + heroData.lvl;

                CancelInvoke("EatDrug");
                CancelInvoke("OnSecondFunction");
            }
        }

        if (exp < 1)
        {
            //点击 进度条走完之后再像服务器发送
            if (isOnClick)
            {
                ItemNodeState itemnodestate = null;
                if (GameLibrary.Instance().ItemStateList.ContainsKey(GoodsDetials.instance.currentSItemData.Id))
                {
                    itemnodestate = GameLibrary.Instance().ItemStateList[GoodsDetials.instance.currentSItemData.Id];
                    //ClientSendDataMgr.GetSingle().GetHeroSend().SendDrugUpgrade(heroData.id, FSDataNodeTable<ItemNode>.GetSingleton().FindDataByType(GoodsDetials.instance.currentSItemData.Id).props_id, useCount, upGradelvl);
                    //ClientSendDataMgr.GetSingle().GetHeroSend().SendDrugUpgrade(heroData.id, itemnodestate.props_id, useCount, upGradelvl);
                    GoodsDataOperation.GetInstance().UseGoods((int)GoodsDetials.instance.currentSItemData.Id, useCount);
                }

                isOnClick  = false;
                upGradelvl = 0;
                useCount   = 0;
            }
            heroData.exps = counts;
            CancelInvoke("OnSecondFunction");
        }
    }
Example #30
0
    protected override void ShowHandler()
    {
        currentCount = 1;
        ItemNodeState itemnodestate = null;

        if (equipItem == null)
        {
            return;
        }
        for (int i = 0; i < playerData.GetInstance().baginfo.itemlist.Count; i++)
        {
            if (equipItem.Id == playerData.GetInstance().baginfo.itemlist[i].Id)
            {
                maxCount = playerData.GetInstance().baginfo.itemlist[i].Count;
            }
        }
        //if (playerData.GetInstance().baginfo.ItemDic.ContainsKey(equipItem.Id))
        //{
        //    maxCount = playerData.GetInstance().baginfo.ItemDic[equipItem.Id].Count;
        //}

        iconS.spriteName = equipItem.IconName;
        goods.spriteName = ItemData.GetFrameByGradeType(equipItem.GradeTYPE);
        goodsName.text   = GoodsDataOperation.GetInstance().JointNameColour(equipItem.Name, equipItem.GradeTYPE);
        if (equipItem.Types == 6 || equipItem.Types == 3)
        {
            debris.gameObject.SetActive(true);
        }
        else
        {
            debris.gameObject.SetActive(false);
        }
        if (equipItem.Types == 3)
        {
            debris.GetComponent <UISprite>().spriteName = "materialdebris";
            debris.GetComponent <UISprite>().MakePixelPerfect();
        }
        else if (equipItem.Types == 6)
        {
            debris.GetComponent <UISprite>().spriteName = "linghunshi";
            debris.GetComponent <UISprite>().MakePixelPerfect();
        }
        icon.uiAtlas = equipItem.UiAtlas;


        //goodsCount.text = equipItem.conut.ToString();
        goodsCount.text = maxCount + "";
        if (GameLibrary.Instance().ItemStateList.ContainsKey(equipItem.Id))
        {
            itemnodestate      = GameLibrary.Instance().ItemStateList[equipItem.Id];
            unitExpValue.text  = itemnodestate.exp_gain.ToString();
            totalExpValue.text = currentCount * itemnodestate.exp_gain + "";
        }
        expPoolValue.text = playerData.GetInstance().selfData.expPool + "";//经验池的经验值
        //saleCount.text = currentCount + "/" + equipItem.conut;
        saleCount.text = currentCount + "/" + maxCount;
    }