Пример #1
0
 public void update()
 {
     for (int i = 0, len = this._currCd.Count; i < len; i++)
     {
         MediatorSystem.timeStart("birth" + i);
         this._currCd[i] -= ConfigConstant.MAP_ACT_TIME_S * this._beans[i].Count;
         if (this._currCd[i] <= 0)
         {
             this._currCd[i] = this.getBeanTotalTime(i + 1);
             if (this._beans[i].Count > 0)
             {
                 LoopBeanEntity bean = this._beans[i][0];
                 this._beans[i].RemoveAt(0);
                 bean.revive();
                 if (!bean.alived)
                 {
                     this._removeCount[i]++;
                     if (3 == this._removeCount[i])
                     {
                         Utils.clearList(this._beans[i]);
                         this._removeCount[i] = 0;
                     }
                 }
                 else
                 {
                     this._removeCount[i] = 0;
                 }
             }
         }
         MediatorSystem.getRunTime("birth" + i, this._beans[i].Count);
     }
 }
Пример #2
0
 public override void update()
 {
     base.update();
     MediatorSystem.timeStart("checkBea");
     this.checkBean();//检查吃豆子
     MediatorSystem.getRunTime("checkBea");
     this.fightResult.update();
 }
Пример #3
0
 internal void testUseCard()
 {
     MediatorSystem.timeStart("useCard");
     for (int i = 0, len = FightMain.instance.selection.players.Count; i < len; i++)
     {
         PlayerEntity player = FightMain.instance.selection.players[i];
         player.cardGroup.expendCard(1);
         //NetAdapter.sendUseCard(player.uid, 1);
     }
     MediatorSystem.getRunTime("useCard");
 }
Пример #4
0
 public override void update()
 {
     base.update();
     MediatorSystem.timeStart("barrierSingle");
     this.checkPerson();
     if (this._bounceSelfRate > 0)
     {
         this.checkBullet();
         this.bounceBack();
         this.applyPosition();
     }
     MediatorSystem.getRunTime("barrierSingle");
 }
Пример #5
0
 public override void update()
 {
     MediatorSystem.timeStart("SinglePlayerUpdate");
     base.update();
     MediatorSystem.getRunTime("SinglePlayerUpdate");
     MediatorSystem.timeStart("actionUpdate");
     this.actionManager.update();
     MediatorSystem.getRunTime("actionUpdate");
     for (int i = this._buffs.Count - 1; i >= 0; i--)
     {
         this._buffs[i].update();
     }
 }
Пример #6
0
    private void onFrameHandler(MainEvent e)
    {
        if (TestValue.test1)
        {
            return;
        }
        MediatorSystem.timeStart("rank");
        List <PlayerEntity> playerList = FightMain.instance.selection.getSortPlayer(1);
        int count = Math.Min(playerList.Count, this._rankList.Count);

        for (int i = 0, len = this._rankList.Count; i < len; i++)
        {
            //最后一个显示自己 并且要求还得都显示的下!
            if (i >= count)
            {
                this._rankList[i].hide();
            }
            else
            {
                if (i == this._rankList.Count - 1)
                {
                    int index = playerList.IndexOf(this.player);
                    if (index >= i) //如果自己不在之前的排行榜里 就显示。
                    {
                        this._rankList[i].changeIndexText(index, this.player);
                    }
                    else
                    {
                        this._rankList[i].hide();
                    }
                }
                else
                {
                    this._rankList[i].changeIndexText(i, (ClientPlayerEntity)playerList[i]);
                }
            }
        }
        MediatorSystem.getRunTime("rank");
    }
Пример #7
0
    private void createBullet()
    {
        object[] bullets = (object[])this._step["bullets"];
        //return;
        Dictionary <string, object> global = this._step.ContainsKey("global") ? (Dictionary <string, object>) this._step["global"] : null;

        MediatorSystem.timeStart("skillCreateBullet");
        BulletShallow shallow = null;

        if (this._step.ContainsKey("shallow"))
        {
            shallow         = new BulletShallow(this._map).init();
            shallow.shallow = Convert.ToDouble(this._step["shallow"]);
        }


        for (int i = 0, len = bullets.Length; i < len; i++)
        {
            //MediatorSystem.timeStart("clone");
            Dictionary <string, object> bulletData = (Dictionary <string, object>)bullets[i];
            //当前的字典 合并到子弹里。
            if (null != global)
            {
                Dictionary <string, object> temp = (Dictionary <string, object>)Utils.clone(global);
                Utils.union1(temp, bulletData);
                bulletData = temp;
            }
            //MediatorSystem.getRunTime("clone");

            BulletEntity bullet = this._player.map.createFightEntity(ConfigConstant.ENTITY_BULLET) as BulletEntity;
            bullet.lockTarget = this._lockTarget;
            bullet.owner      = this._player;
            bullet.shallow    = shallow;
            bullet.initConfig(bulletData);
        }

        MediatorSystem.getRunTime("skillCreateBullet", bullets.Length);
    }
Пример #8
0
    protected virtual void onMapUpdate()
    {
        if (this.refereeController.isEnd)
        {
            return;
        }
        this.stepIndex++;
        MediatorSystem.timeStart("hitUpdate");
        //检查碰撞。。。
        for (int i = 0, len = this.persons.Count - 1; i < len; i++)
        {
            if (!this.persons[i].alived || this.persons[i].collisionShape.radius <= 0)
            {
                continue;
            }
            for (int j = i + 1, len2 = this.persons.Count; j < len2; j++)
            {
                if (!this.persons[j].alived || this.persons[j].collisionShape.radius <= 0)
                {
                    continue;
                }
                this.checkPlayerHit2(this.persons[i], this.persons[j]);
            }
        }
        MediatorSystem.getRunTime("hitUpdate");


        //ai计算 Biggo添加
        MediatorSystem.timeStart("aiUpdate");
        if (!TestValue.test4 && null != this.aiController)
        {
            this.aiController.update();
        }
        MediatorSystem.getRunTime("aiUpdate");

        //if(!TestValue.test2) {
        MediatorSystem.timeStart("playerUpdate");
        for (int i = this.persons.Count - 1; i >= 0; i--)
        {
            if (this.persons[i].alived)
            {
                this.persons[i].update();
            }
        }
        MediatorSystem.getRunTime("playerUpdate", this.persons.Count);
        //}


        //if(!TestValue.test3) {
        MediatorSystem.timeStart("beasUpdate");
        for (int i = this.beans.Count - 1; i >= 0; i--)
        {
            if (this.beans[i].alived)
            {
                this.beans[i].update();
            }
        }
        MediatorSystem.getRunTime("beasUpdate", this.beans.Count);
        //}
        //if(!TestValue.test4) {
        MediatorSystem.timeStart("othersUpdate");
        for (int i = this.others.Count - 1; i >= 0; i--)
        {
            this.others[i].update();
        }
        MediatorSystem.getRunTime("othersUpdate", this.others.Count);
        //}

        //if(!TestValue.test5) {
        MediatorSystem.timeStart("bulletsUpdate");
        //Debug.Log("update");
        for (int i = this.bullets.Count - 1; i >= 0; i--)
        {
            this.bullets[i].update();
        }
        MediatorSystem.getRunTime("bulletsUpdate", this.bullets.Count);
        //}

        //if(!TestValue.test6) {
        MediatorSystem.timeStart("applyPosition");
        for (int i = this.persons.Count - 1; i >= 0; i--)
        {
            if (this.persons[i].alived)
            {
                this.persons[i].applyPosition();
            }
        }
        MediatorSystem.getRunTime("applyPosition", this.persons.Count);

        //}

        this._delayCalls.update();
        //if(!TestValue.test7) {
        this.birthBeanController.update();
        this.refereeController.update();
        //}
    }
Пример #9
0
    private void nextFrame()
    {
        if (this.stepIndex < this._steps.Count)
        {
            MediatorSystem.timeStart("serverAtc");
            this.dispatchEventWith(EventConstant.START);
            if (0 != this.fakeCount)
            {
                this.regainFake();                    //先回复到正常的状态。
            }
            object mapData = null;
            MediatorSystem.timeStart("parseData");
            if (null != this._steps[this.stepIndex])
            {
                List <Dictionary <string, object> > steps = this._steps[this.stepIndex];
                for (int i = 0, len = steps.Count; i < len; i++)
                {
                    this.parseData(steps[i]);
                }
                //上线的时候 不要保存数据 所以就扔了吧。 只保留数组长度。
                if (UnityEngine.Random.value > 100)
                {
                    this._steps[this.stepIndex] = null;
                }
                //mapData = steps[steps.Count - 1];
            }
            MediatorSystem.getRunTime("parseData");

            MediatorSystem.timeStart("onMapUpdate");
            this.onMapUpdate();
            MediatorSystem.getRunTime("onMapUpdate");

            if (FightMain.equal)
            {
                //if(( this.startStepIndex + this.stepIndex - 1) % 500 == 0 && NetAdapter.mapData.Count > 0) {
                //try {
                //object mapData = NetAdapter.mapData[0];
                //NetAdapter.mapData.RemoveAt(0);
                Dictionary <string, object> equalInfo = ViewUtils.equal(this.getData(), mapData, "");
                if (equalInfo.Count != 0)
                {
                    this.pause = true;
                    FightMain.instance.equalPanel.show(equalInfo);
                }
                //} catch(Exception e) {
                //    Debug.Log("equal出错了");
                //}
            }
            //}

            MediatorSystem.getRunTime("serverAtc");
        }
        else
        {
            if (0 == this.fakeCount)
            {
                this.saveFake();                    //记录当前虚假运行的。
            }
            this.fakeUpdate();
            MediatorSystem.log("fakeCount", this.stepIndex + "  " + this.fakeCount);
        }
    }
Пример #10
0
    protected override void onUpdate()
    {
        if (this.pause)
        {
            return;
        }
        //MediatorSystem.log("stepCount", this._steps.Count - this.stepIndex);

        float viewActTime = (Time.time - this.startTime) * 1000;
        // 有新包的 并且之前有假的 那么要重新开始播。
        int startIndex = (this.isStack && this.fakeCount != 0 ? this.stepIndex : this.totalIndex);

        if (Time.deltaTime * 1000 > 40f || Time.deltaTime * 1000 < 25f)
        {
            //MediatorSystem.log("deltaTime", Time.deltaTime * 1000);
            intervaldd += Time.deltaTime * 1000 - 33f;
        }

        if (this.isStack)
        {
            this.isStack = false;
            float lastStepTime = (this._steps.Count) * ConfigConstant.MAP_ACT_TIME_S - 66f;
            if (viewActTime < lastStepTime)
            {
                this.startTime -= (lastStepTime - viewActTime) / 1000;
                viewActTime     = lastStepTime;
                Debug.Log("更新到服务器最新时间");
            }
        }
        viewActTime -= intervaldd;
        float cc = intervaldd * 0.05f;

        intervaldd -= cc;
        //MediatorSystem.log("intervaldd", intervaldd);

        float pos = viewActTime / ConfigConstant.MAP_ACT_TIME_S;

        //Debug.Log(( Time.time - this.startTime ) * 1000 + "  " + ( viewActTime / ConfigConstant.MAP_ACT_TIME_S ) + "   " + ( ( this._steps.Count ) * ConfigConstant.MAP_ACT_TIME_S - 66f ));
        MediatorSystem.timeStart("nextFrame");
        int len = (int)pos - startIndex;

        if (len > 0)
        {
            for (int i = 0; i < len; i++)
            {
                this.nextFrame();
            }
            if (this.fakeCount > 0)
            {
                this.netOffset += 2;
                if (this.netOffset > 5)
                {
                    this.startTime += 66f / 1000;
                    this.netOffset  = 0;
                    Debug.Log("延伸startTime时间");
                }
            }
            else
            {
                this.netOffset *= 0.95f;
            }
            this.dispatchEventWith(EventConstant.LOGIC_COMPLETE);
        }

        MediatorSystem.getRunTime("nextFrame", "num:" + ((int)pos - startIndex));
        this.totalIndex = (int)pos;

        if (!TestValue.test8)
        {
            MediatorSystem.timeStart("clientAtc");
            this.mapViewUpdate(pos - this.totalIndex);
            MediatorSystem.getRunTime("clientAtc");
        }

        if (this.isComplete)
        {
            this.finish();
        }
    }
Пример #11
0
    void Update()
    {
        if (!this.isPlay)
        {
            return;
        }
        if (Input.GetKeyUp(KeyCode.Escape))
        {
            this.isPlay = false;
            this.cc     = 4;
        }
        else if (Input.GetKeyUp(KeyCode.F1))
        {
            this.isPlay = true;
            this.cc     = 5;
        }
        else if (Input.GetKeyUp(KeyCode.A))
        {
            isTest = !isTest;
        }
        else if (Input.GetKeyUp(KeyCode.S))
        {
            //NetSocket.test = true;
            NetAdapter.delayCount = Convert.ToInt32(TestValue.value) / ConfigConstant.MAP_ACT_TIME_S;
        }
        else if (Input.GetKeyUp(KeyCode.W))
        {
            FightMain.instance.selection.localPlayer.changeScore(-100000);
        }
        else if (Input.GetKeyUp(KeyCode.D))
        {
            FightMain.instance.selection.localPlayer.changeScore(100000);
        }
        else if (Input.GetKeyUp(KeyCode.C))
        {
            this.testUseCard();
        }
        else if (Input.GetKeyUp(KeyCode.Z))
        {
            this._selection.refereeController.radishController.addTeamPoint(0, 1);
        }
        else if (Input.GetKeyUp(KeyCode.X))
        {
            this._selection.refereeController.radishController.addTeamPoint(1, 1);
        }
        else if (Input.GetKeyUp(KeyCode.B))
        {
            Dictionary <string, object> bulletData = new Dictionary <string, object> {
                { "resId", "bulletNull" },
                { "speed", 1 },
                { "lifeTime", 30 },
                { "atk", 100000 },
                { "range", new object[] { ConfigConstant.SHIP_RADIUS } },
                { "posTarget", 1 },
                { "bangRes", "hitCollide" },
            };
            BulletEntity bullet = this._selection.createFightEntity(ConfigConstant.ENTITY_BULLET) as BulletEntity;
            bullet.lockTarget = this._selection.localPlayer;
            bullet.owner      = this._selection.localPlayer;
            bullet.initConfig(bulletData);
        }
        else if (Input.GetKeyUp(KeyCode.P))
        {
            this._selection.startTime += 33f / 1000;
        }


        MediatorSystem.timeStart("FightMain");
        //try {
        if (FightMain.isLocal && null != this.server)
        {
            this.server.update();
        }

        if (null != this._selection)
        {
            this._selection.update();
        }
        //} catch(Exception e) {
        //    LogMessage.instance.text.text += e.Message + "\n" + e.StackTrace;
        //    NetAdapter.sendQuitFight();
        //}


        //if(Input.GetKeyUp(KeyCode.Keypad1)) {
        //    this.selection = this.clients[0];
        //}else if(Input.GetKeyUp(KeyCode.Keypad2)) {
        //    this.selection = this.clients[1];
        //}else if(Input.GetKeyUp(KeyCode.Keypad3)) {
        //    this.selection = this.clients[2];
        //}
        MediatorSystem.getRunTime("FightMain");
    }
Пример #12
0
    void Update()
    {
        // ios gamecenter
                #if UNITY_IOS
        if (Social.localUser.authenticated)
        {
            if (!socialFirstGot && GameCenterManager.gameCenterIsSuccess)              //第一次打开游戏,记录第一个 gameCenterUID
            {
                socialUID        = Social.localUser.id;
                socialUNAME      = Social.localUser.userName;
                socialUIDchanged = false;
                socialFirstGot   = true;              //d
            }
            else
            {
                CheckChange();
            }
        }
        else
        {
            if (socialFirstGot)
            {
                CheckChange();
            }
        }
                #endif
//		if (gameModel != null && gameModel.time.Ticks != 0)
//		{
//			gameModel.time = gameModel.time.AddTicks ((long)(Time.deltaTime * 1000 * 10000));
//		}
        if (time <= 0)
        {
            if (Input.GetKey(KeyCode.F1))
            {
                LocalStore.Clear();
//				LocalStore.DelLocal(LocalStore.LOCAL_TYPE);
//				LocalStore.DelLocal(LocalStore.LOCAL_UID);
//				LocalStore.DelLocal(LocalStore.LOCAL_PWD);
                RELOGIN_GAME(null);
                roleModel.uids.Clear();
                time = 1;
            }
            else if (Input.GetKey(KeyCode.F4))
            {
                PlatForm.inst.HTTP = "http://192.168.1.118:8899/gateway/";
                RELOGIN_GAME(null);
                roleModel.uids.Clear();
                time = 1;
            }
            else if (Input.GetKey(KeyCode.F5))
            {
                PlatForm.inst.HTTP = "http://192.168.1.119:8899/gateway/";
                RELOGIN_GAME(null);
                roleModel.uids.Clear();
                time = 1;
            }
            else if (Input.GetKey(KeyCode.F2))
            {
                PhoneManager.inst.ScreenImage("screen_" + Tools.GetDateTimeString());
                time = 1;
            }
            else if (Input.GetKey(KeyCode.F3))
            {
                this.StartCoroutine(ScreenImage());
                time = 1;
            }
            else if (Input.GetKey(KeyCode.Home))
            {
                if (log == null)
                {
                    log = new ComLog();
                    GRoot.inst.AddChild(log.group);
                }
                else
                {
                    GRoot.inst.RemoveChild(log.group);
                    log = null;
                }
                time = 1;
            }
        }
        time -= Time.deltaTime;
        //		Log.debug ("time - " + time);
        MediatorSystem.timeStart("timerManager");
        TimerManager.inst.Update();
        MediatorSystem.getRunTime("timerManager");
    }