コード例 #1
0
 private void Update()
 {
     if (this.cur < 0)
     {
         this.line.transform.localScale = Vector3.zero;
         return;
     }
     this.line.transform.localScale = Vector3.one;
     if (this.m_fOver)
     {
         if (this.m_scroll_bar.fillAmount >= 1f)
         {
             this.m_funcCallBack();
             UnityEngine.Object.Destroy(base.gameObject);
         }
         this.m_scroll_bar.fillAmount = this.m_scroll_bar.fillAmount + Time.deltaTime * 3f;
         if (this.m_scroll_bar.fillAmount >= 1f)
         {
             this.m_scroll_bar.fillAmount = 1f;
         }
     }
     else if (this.realT)
     {
         float fillAmount = (float)this.cur / (float)this.max;
         this.m_scroll_bar.fillAmount = fillAmount;
     }
     else
     {
         float num = (float)this.cur / (float)this.max;
         if (this.m_scroll_bar.fillAmount < num)
         {
             this.m_scroll_bar.fillAmount += Time.deltaTime * 0.2f;
         }
         if (this.m_scroll_bar.fillAmount > num)
         {
             this.m_scroll_bar.fillAmount = num;
         }
         if (this.m_scroll_bar.fillAmount >= 0.9f)
         {
             this.m_scroll_bar.fillAmount = 0.9f;
         }
     }
     this.tick++;
     if (this.tick > 3)
     {
         this.tick = 0;
         if (this.state != 0)
         {
             if (this.state == 1)
             {
                 if (this.tempTick > 3)
                 {
                     this.tempTick = 1;
                 }
                 this.lineTxt.text = ContMgr.getOutGameCont("init" + this.tempTick, new string[]
                 {
                     (int)((float)this.cur / (float)this.max * 100f) + string.Empty
                 });
                 this.tempTick++;
             }
             else if (this.state == 2)
             {
                 if (this.tempTick > 3)
                 {
                     this.tempTick = 1;
                 }
                 this.lineTxt.text = ContMgr.getOutGameCont("loading" + this.tempTick, new string[]
                 {
                     (int)((float)this.cur / (float)this.max * 100f) + string.Empty
                 });
                 Debug.Log("load::" + (int)(this.m_scroll_bar.fillAmount * 100f));
                 this.tempTick++;
             }
         }
     }
 }
コード例 #2
0
 public void onfail(string error)
 {
     this.m_scroll_bar.fillAmount = 0f;
     this.showComfirm(ContMgr.getOutGameCont("error", new string[0]), new Action(this.onClick));
 }
コード例 #3
0
    public MonsterRole AddDartCar(Variant d)//镖车
    {
        init();
        if (GRMap.grmap_loading)
        {
            cacheProxy.Add(d);
            return(null);
        }
        Vector3 born_pt  = new Vector3(d["x"] / GameConstant.PIXEL_TRANS_UNITYPOS, 0f, d["y"] / GameConstant.PIXEL_TRANS_UNITYPOS);
        int     id       = d["mid"];
        uint    serverid = d["iid"];

        if (m_mapMonster.ContainsKey(serverid))
        {
            return(m_mapMonster[serverid]);
        }

        SXML   xml    = dMon[id];
        int    tempid = xml.getInt("obj");
        float  scale  = xml.getFloat("scale");
        string name   = string.Empty;

        if (serverid <= 0)
        {
            if (Globle.m_nTestMonsterID > 0)
            {
                tempid = Globle.m_nTestMonsterID;
            }
        }
        MDC000 mon = new MDC000();

        mon.tempXMl  = xml;
        mon.isBoos   = xml.getInt("boss") == 1;
        mon.isBoss_c = xml.getInt("boss_c") == 1;
        if (scale > 0f)
        {
            mon.scale = scale;
        }
        if (mon != null)
        {
            if (serverid > 0)
            {
                mon.m_unIID = serverid;
                m_mapMonster.Add(serverid, mon);//这个地图上的所有的monster
            }
            else
            {
                mon.isfake  = true;
                mon.m_unIID = idIdx;
                m_mapFakeMonster.Add(idIdx, mon);
                idIdx++;
            }

            mon.Init("monster_" + tempid, EnumLayer.LM_MONSTER, born_pt, 0);
            mon.curhp       = d["hp"];
            mon.maxHp       = d["battleAttrs"]["max_hp"];
            mon.escort_name = d["escort_name"];
            PlayerNameUIMgr.getInstance().show(mon);
            PlayerNameUIMgr.getInstance().setDartName(mon, d["escort_name"] + ContMgr.getCont("MonsterMgr1"));
            mon.roleName  = d["escort_name"] + ContMgr.getCont("MonsterMgr1");
            mon.monsterid = id;
            if (mon.roleName == A3_LegionModel.getInstance().myLegion.name)
            {
                mon.m_isMarked = false;
            }

            //if (GRMap.grmap_loading == false)
            //    mon.refreshViewType(2);

            mon.dartid = id;
            mon.isDart = true;
        }
        m_listMonster.Add(mon);
        if (mon != null)
        {
            dispatchEvent(GameEvent.Create(MonsterMgr.EVENT_MONSTER_ADD, this, mon));
        }


        if (d.ContainsKey("moving"))
        {
            uint  iid  = d["iid"]._uint;
            var   vv   = MonsterMgr._inst.getMonster(iid);
            float to_x = d["moving"]["to_x"]._float;
            float to_y = d["moving"]["to_y"]._float;

            NavMeshHit hit;
            Vector3    vec = new Vector3(to_x * 32 / GameConstant.PIXEL_TRANS_UNITYPOS, 0f, to_y * 32 / GameConstant.PIXEL_TRANS_UNITYPOS);
            NavMesh.SamplePosition(vec, out hit, 100f, vv.m_layer);
            vv.SetDestPos(hit.position);
        }
        return(mon);
    }
コード例 #4
0
    public void OnTriggerEnter(Collider other)
    {
        HitData hd = other.gameObject.GetComponent <HitData>();

        if (hd == null)
        {
            return;
        }
        if (hd.m_haveHittedList.Contains(m_selfRole.m_unIID))
        {
            return;
        }
        else
        {
            hd.m_haveHittedList.Add(m_selfRole.m_unIID);
        }

        if (PlayerModel.getInstance().up_lvl >= 1)
        {
            if (CanHited(m_selfRole, hd))
            {
                //临时处理只碰一次
                if (hd.m_bOnlyHit)
                {
                    other.enabled = false;
                }

                if (hd.m_unSkillID == 3003)
                {//冰雨技能攻击到时播放dead2的特效
                    hd.HitAndStop(EnumAni.ANI_T_FXDEAD1);
                }
                else if (hd.m_unSkillID == 3006)
                {//陨石可穿过模型
                }
                else
                {
                    //停止动画
                    hd.HitAndStop();
                }

                if (hd.m_CastRole != null && hd.m_CastRole.isfake)
                {
                    m_selfRole.onHurt(hd);
                }

                //主角自己受到的伤害让服务器下发好了,自己不用去关心
                //m_selfRole.onHurt(hd);
                m_selfRole.ShowHurtFX(hd.m_nHurtFX);


                //if (hd.m_bNeedKill)
                //{
                //    GameObject.Destroy(other.gameObject);
                //}
                //播放死亡
                //GameObject.Destroy(other.gameObject);

                //显示迎战的ui
                if (!hd.m_CastRole.m_isMain && hd.m_CastRole is ProfessionRole && PlayerModel.getInstance().now_pkState == 0)//PlayerModel.getInstance().now_pkState == 0 && hd.m_CastRole is ProfessionRole && PlayerModel.getInstance().now_nameState==0
                {
                    if (!hd.m_CastRole.isDead || hd.m_CastRole != null || !m_selfRole.isDead)
                    {
                        a3_expbar.instance.ShowAgainst(hd.m_CastRole);
                    }
                }

                //我非全体模式时,打我的人是我的团员或者对友,飘字提示
                if (PlayerModel.getInstance().now_pkState != 1 && !hd.m_CastRole.m_isMain && hd.m_CastRole is ProfessionRole)
                {
                    if ((TeamProxy.getInstance().MyTeamData != null && TeamProxy.getInstance().MyTeamData.IsInMyTeam(hd.m_CastRole.roleName)) ||
                        (PlayerModel.getInstance().clanid != 0 && PlayerModel.getInstance().clanid == hd.m_CastRole.m_unLegionID))
                    {
                        flytxt.instance.fly(ContMgr.getCont("a3_pkmodel"));
                    }
                }
            }
        }
    }
コード例 #5
0
    public MonsterRole AddSummon(Variant m)
    {
        init();
        if (GRMap.grmap_loading)
        {
            cacheProxy.Add(m);
            return(null);
        }

        Vector3 born_pt  = new Vector3(m["x"] / GameConstant.PIXEL_TRANS_UNITYPOS, 0f, m["y"] / GameConstant.PIXEL_TRANS_UNITYPOS);
        int     id       = m["mid"];
        uint    serverid = m["iid"];

        if (m_mapMonster.ContainsKey(serverid))
        {
            if (m["owner_cid"] == PlayerModel.getInstance().cid)
            {
                if (a3_herohead.instance)
                {
                    A3_SummonModel.getInstance().lastatkID = 0;
                    a3_herohead.instance.refresh_sumHp(m["hp"], m["battleAttrs"]["max_hp"]);
                    a3_herohead.instance.refresh_sumbar();
                    a3_herohead.instance.do_sum_CD = false;
                }
            }
            return(m_mapMonster[serverid]);
        }

        //return null;

        SXML   xml    = dMon[id];
        int    tempid = xml.getInt("obj");
        float  scale  = xml.getFloat("scale");
        string name   = xml.getString("name");

        if (serverid <= 0)
        {
            if (Globle.m_nTestMonsterID > 0)
            {
                tempid = Globle.m_nTestMonsterID;
            }
        }

        MS0000 mon = new MS0000();

        mon.tempXMl = xml;

        mon.isBoos   = xml.getInt("boss") == 1;
        mon.isBoss_c = xml.getInt("boss_c") == 1;
        if (scale > 0f)
        {
            mon.scale = scale;
        }

        if (mon != null)
        {
            if (serverid > 0)
            {
                mon.m_unIID = serverid;
                m_mapMonster.Add(serverid, mon);
                roleSummonMapping[m["owner_cid"]] = serverid;       // 人物对应的召唤兽 id
            }
            else
            {
                mon.isfake  = true;
                mon.m_unIID = idIdx;
                m_mapFakeMonster.Add(idIdx, mon);
                idIdx++;
            }

            mon.masterid = m["owner_cid"];
            mon.issummon = true;
            mon.summonid = id;

            if (SceneCamera.m_nModelDetail_Level != 1 && mon.masterid != PlayerModel.getInstance().cid)
            {//设置隐藏召唤兽
                mon.Init("monster_" + tempid, EnumLayer.LM_DEFAULT, born_pt, 0);
            }
            else
            {
                mon.Init("monster_" + tempid, EnumLayer.LM_MONSTER, born_pt, 0);
            }
            mon.m_layer = EnumLayer.LM_MONSTER;

            PlayerNameUIMgr.getInstance().show(mon);
            PlayerNameUIMgr.getInstance().setName(mon, name, m["owner_name"] + ContMgr.getCont("MonsterMgr"));
            mon.roleName  = name;
            mon.monsterid = id;

            //if (GRMap.grmap_loading == false)
            //    mon.refreshViewType(2);


            //mon.master = RoleMgr._instance.getRole(m["owner_cid"]);

            if (mon.masterid == PlayerModel.getInstance().cid)
            {
                if (a3_herohead.instance)
                {
                    A3_SummonModel.getInstance().lastatkID = 0;
                    a3_herohead.instance.refresh_sumHp(m["hp"], m["battleAttrs"]["max_hp"]);
                    a3_herohead.instance.refresh_sumbar();
                    a3_herohead.instance.do_sum_CD = false;
                }
            }
        }
        m_listMonster.Add(mon);

        if (mon != null)
        {
            dispatchEvent(GameEvent.Create(MonsterMgr.EVENT_MONSTER_ADD, this, mon));
        }

        if (mon != null)
        {
            mon.curhp     = m["hp"];
            mon.maxHp     = m["battleAttrs"]["max_hp"];
            mon.owner_cid = m["owner_cid"];
        }
        return(mon);
    }