Exemplo n.º 1
0
 protected virtual void OnUpdate()
 {
     if (Input.GetKeyDown(KeyCode.E))
     {
         TipsUtil.ShowExpTips(10000);
     }
     if (Input.GetKeyDown(KeyCode.C))
     {
         TipsUtil.ShowCoinTips(10000);
     }
     if (Input.GetKeyDown(KeyCode.T))
     {
         TipsUtil.ShowTextTips("世事如棋 乾坤莫测");
     }
     if (Input.GetKeyDown(KeyCode.G))
     {
         TipsUtil.ShowGoldTips(666666);
     }
     if (Input.GetKeyDown(KeyCode.B))
     {
         TipsUtil.ShowGoldBindingTips(888888);
     }
 }
Exemplo n.º 2
0
    private void OnRoleDieCallBack(RoleCtrl ctrl)
    {
        GameLevelMonsterEntity entity = ((RoleInfoMonster)ctrl.CurrRoleInfo).GameLevelMonsterEntity;

        TipsUtil.ShowExpTips(entity.DropExp);
        TipsUtil.ShowCoinTips(entity.DropCoin);
        m_DropExp  += entity.DropExp;
        m_DropCoin += entity.DropCoin;
        m_CurrRegionKillMonsterCount++;
        //掉落装备/材料
        int equipNum = UnityEngine.Random.Range(1, 101);

        if (equipNum > 50)
        {
            int tempNum = UnityEngine.Random.Range(1, 101);
            int equipId = 0;
            if (tempNum < 35)
            {
                equipId = entity.DropEquip[0][0].ToInt();
            }
            else if (tempNum < 60)
            {
                equipId = entity.DropEquip[1][0].ToInt();
            }
            else if (tempNum < 80)
            {
                equipId = entity.DropEquip[2][0].ToInt();
            }
            else if (tempNum < 95)
            {
                equipId = entity.DropEquip[3][0].ToInt();
            }
            else
            {
                equipId = entity.DropEquip[4][0].ToInt();
            }
            //掉落装备
            //Debuger.Log("掉落装备Id = " + equipId);
            GameLevelSuccessRequestProto.GoodsItem item = new GameLevelSuccessRequestProto.GoodsItem();
            item.GoodsType  = 1;
            item.GoodsCount = 1;
            item.GoodsId    = equipId;
            m_DropGoodsList.Add(item);
        }
        int matNum = UnityEngine.Random.Range(1, 101);

        if (matNum > 50)
        {
            int tempNum2 = UnityEngine.Random.Range(1, 101);
            int matId    = 0;
            if (tempNum2 < 35)
            {
                matId = entity.DropMaterial[0][0].ToInt();
            }
            else if (tempNum2 < 60)
            {
                matId = entity.DropMaterial[1][0].ToInt();
            }
            else if (tempNum2 < 80)
            {
                matId = entity.DropMaterial[2][0].ToInt();
            }
            else if (tempNum2 < 95)
            {
                matId = entity.DropMaterial[3][0].ToInt();
            }
            else
            {
                matId = entity.DropMaterial[4][0].ToInt();
            }
            //掉落材料
            //Debuger.LogError("掉落材料Id = " + matId);
            bool isHaveMat = false;
            for (int i = 0; i < m_DropGoodsList.Count; i++)
            {
                if (m_DropGoodsList[i].GoodsId == matId)
                {
                    isHaveMat = true;
                    GameLevelSuccessRequestProto.GoodsItem item = new GameLevelSuccessRequestProto.GoodsItem();
                    item.GoodsType     = m_DropGoodsList[i].GoodsType;
                    item.GoodsId       = m_DropGoodsList[i].GoodsId;
                    item.GoodsCount    = m_DropGoodsList[i].GoodsCount + 1;
                    m_DropGoodsList[i] = item;
                    break;
                }
            }
            if (!isHaveMat)
            {
                GameLevelSuccessRequestProto.GoodsItem item = new GameLevelSuccessRequestProto.GoodsItem();
                item.GoodsType  = 2;
                item.GoodsCount = 1;
                item.GoodsId    = matId;
                m_DropGoodsList.Add(item);
            }
        }

        if (m_CurrRegionKillMonsterCount >= m_CurrRegionMonsterCount)
        {
            if (m_CurrRegionIndex < m_Region.Length - 1)
            {
                //进入下一区域
                m_CurrRegionIndex++;
                EnterRegion(m_CurrRegionIndex);
            }
            else
            {
                m_IsFighting = false;
                GameLevelCtrl.Instance.Result   = 1;
                GameLevelCtrl.Instance.UseTime  = m_UseTime;
                GameLevelCtrl.Instance.DropExp  = m_DropExp;
                GameLevelCtrl.Instance.DropCoin = m_DropCoin;
                //最后一击播放慢动画
                TimeManager.Instance.ChangeTimeScale(0.3f, 5f, OpenFightResultWindow);
                //战斗胜利
                Debug.Log("战斗胜利");
            }
        }
    }