Ejemplo n.º 1
0
        public AddAbsenceWindow(RefereeController refereeController)
        {
            InitializeComponent();
            _refereeController = refereeController;

            DatePicker.SelectedDate = DateTime.Now;
        }
Ejemplo n.º 2
0
 public override void init(RefereeController refereeController)
 {
     base.init(refereeController);
     this.radish = (RadishEntity)this._map.createFightEntity(ConfigConstant.ENTITY_RADISH);
     this.radish.initConfig((Dictionary <string, object>)ConfigConstant.combat["radish"]);
     this.radishCD    = new IntervalAction(this._map).init(ConfigConstant.RADISH_POINT_CD, int.MaxValue, this.addPoint);
     this.radishCD.cd = this.radishCD.interval;
 }
Ejemplo n.º 3
0
        public RefereeWindow(Referee myRefereeAccount)
        {
            InitializeComponent();

            _myRefereeAccount  = myRefereeAccount;
            _refereeController = new RefereeController(this, _myRefereeAccount);

            absenceDates = _refereeController.GetAbsenceDates();
            gameDates    = _refereeController.GetGameDates();
            _refereeController.LoadExcuses();
        }
Ejemplo n.º 4
0
 public override void setData(Dictionary <string, object> data)
 {
     this.teamPointArray  = new List <object>((object[])data["teamPointArray"]).ConvertAll <int>((object o) => { return((int)o); });
     this.playerListArray = new List <object>((object[])data["playerListArray"]).ConvertAll <List <PlayerEntity> >((object o) => {
         return(new List <object>((object[])o).ConvertAll <PlayerEntity>((object id) => {
             return (PlayerEntity)this._map.getNetObject((int)id);
         }));
     });
     this._refereeController = (RefereeController)this._map.getNetObject((int)(data["refereeController"]));
     this.winnerTeam         = (int)data["winnerTeam"];
     base.setData(data);
 }
Ejemplo n.º 5
0
        public void Get_All_Referees()
        {
            //Arrange
            RefereeController controller = new RefereeController(_context);

            //Act
            var result = controller.Get();

            //Assert
            var typedResult = (IEnumerable <V1.RefereeResponse>)Assert.IsType <OkObjectResult>(result).Value;

            typedResult.Should().HaveCount(2);
            typedResult.Should().Contain(s => s.Name == "Eduardo Iturralde").And.Contain(s => s.Name == "Graham Poll");
        }
Ejemplo n.º 6
0
        public void Get_One_Referee()
        {
            //Arrange
            RefereeController controller = new RefereeController(_context);
            IActionResult     result     = controller.Get();
            IEnumerable <V1.RefereeResponse> typedResult = (IEnumerable <V1.RefereeResponse>)Assert.IsType <OkObjectResult>(result).Value;
            int id = typedResult.ToList().First().Id;

            //Act
            var resultGet = controller.Get(id);

            //Assert
            var typedResultGet = (V1.RefereeResponse)Assert.IsType <OkObjectResult>(resultGet).Value;

            typedResultGet.Should().Match <V1.RefereeResponse>(m => m.Name == "Eduardo Iturralde");
        }
Ejemplo n.º 7
0
    public virtual void init(RefereeController refereeController)
    {
        this._refereeController = refereeController;
        this.teamPointArray     = new List <int>();
        this.playerListArray    = new List <List <PlayerEntity> >();
        for (int i = 0; i < TEAM_COUNT; i++)
        {
            this.playerListArray.Add(new List <PlayerEntity> ());
            this.teamPointArray.Add(0);
        }

        for (int i = 0, len = this._map.players.Count; i < len; i++)
        {
            PlayerEntity player = this._map.players[i];
            this.playerListArray[player.teamIndex].Add(player);
        }
    }
Ejemplo n.º 8
0
    //这个只会在初始化调用 server需要手动调用。 但是客户端之后播放录像的时候调用初始化。
    protected void initMap()
    {
        //这两个参数需要后端自己赋值。 先临时这么写一下。
        if (FightMain.instance.mode == ConfigConstant.MODE_CHAOS || FightMain.instance.mode == ConfigConstant.MODE_TEST_CHAOS)
        {
            FightMain.instance.mapId = "map01";
        }
        else
        {
            FightMain.instance.mapId = "map02";
        }
        this.mapData             = new MapData(FightMain.instance.mapId, FightMain.instance.mode);
        this._delayCalls         = new MultiAction(this);
        this.birthBeanController = new BirthBeanController(this);
        this.birthBeanController.init();
        //Biggo添加
        //if (FightMain.isLocal)
        this.aiController = new AIController(this);



        //警告之后地图里的要加速。
        this.warnning   = this.addDelayCall((this.mapData.fightTime - this.mapData.finalTime) * 1000, this.warningTimeHandler, ConfigConstant.MAP_CALL_BACK_WARNING);
        this.birthGrids = new BirthGridManager(this);
        this.findEntity = new FindEntityManager(this);
        this.createBarrier();
        this.birthGrids.createBirthGrids();
        //这一步如果有萝卜 就创建萝卜。
        this.refereeController = new RefereeController(this);
        this.refereeController.init();
        this.createPlayers();
        FightMain.isTest = true;
        this.createBean();
        this.birthBeanController.removeWaitBean();
        //this.printGrid();
    }
Ejemplo n.º 9
0
        public void Create_New_Referee()
        {
            //Arrange
            RefereeController controller = new RefereeController(_context);

            V1.RefereeRequest referee = new V1.RefereeRequest()
            {
                Name          = "Pierluigi Collina",
                MinutesPlayed = 270,
            };

            //Act
            var resultCreate = controller.Create(referee);
            var result       = controller.Get();

            //Assert
            Assert.IsType <NoContentResult>(resultCreate);
            var typedResult = (IEnumerable <V1.RefereeResponse>)Assert.IsType <OkObjectResult>(result).Value;

            typedResult.Should().HaveCount(3);
            typedResult.Should().Contain(s => s.Name == "Pierluigi Collina")
            .And.Contain(s => s.Name == "Eduardo Iturralde")
            .And.Contain(s => s.Name == "Graham Poll");
        }
Ejemplo n.º 10
0
    protected virtual void setData(Dictionary <string, object> data)
    {
        this.mapData = new MapData(data["id"].ToString(), (int)(data["fightMode"]));
        if (data.ContainsKey("playerInitData"))
        {
            this.mapData.playerInitData = new List <object>((object[])data["playerInitData"]);
        }
        this.birthGrids = new BirthGridManager(this);
        this.findEntity = new FindEntityManager(this);
        //TODO:写在这里 容易对比。 后端不用抄setData的方法。
        List <Dictionary <string, object> > netObjectDatas = new List <object>((object[])data["entitys"]).ConvertAll <Dictionary <string, object> >((object obj) => {
            return((Dictionary <string, object>)obj);
        });

        netObjectDatas.Sort((Dictionary <string, object> obj1, Dictionary <string, object> obj2) => {
            return((int)(obj1["type"]) - (int)(obj2["type"]));
        });

        Dictionary <int, INetObject> netObjects = this._netObjects;

        this._netObjects = new Dictionary <int, INetObject>();


        //先生成出netObject
        for (int i = 0, len = netObjectDatas.Count; i < len; i++)
        {
            int        netId = (int)(netObjectDatas[i]["netId"]);
            INetObject obj   = netObjects.ContainsKey(netId) ? netObjects[netId] : null;
            int        type  = (int)(netObjectDatas[i]["type"]);
            if (null != obj && obj.type != type)
            {
                throw new Exception("初始化类型不对!");
            }
            if (null == obj)
            {
                NetObjectFactory.createNetObject(type, this, netId);
            }
            else
            {
                netObjects.Remove(netId);
                this.addNetObject(obj);
            }
        }

        //netObject已经被移除掉了。 此时如果再有就说明恢复过程中有被删除的。这里手动的把它们删除掉!
        foreach (INetObject obj in netObjects.Values)
        {
            Utils.clearObject(obj);
        }


        this.netId          = (int)(data["netId"]);
        this.random.seed    = long.Parse((data["randomSeed"]).ToString());
        this.random.seedNum = (int)(data["randomSeedNum"]);
        this._delayCalls    = (MultiAction)this.getNetObject((int)(data["delayCalls"]));
        this.speedRate      = Convert.ToSingle(data["speedRate"]);
        this.powerGain      = (int)(data["powerGain"]);
        this.killPlayerNum  = (int)(data["killPlayerNum"]);
        if (data.ContainsKey("warnning"))
        {
            this.warnning          = (TimeAction)this.getNetObject((int)(data["warnning"]));
            this.warnning.callBack = this.warningTimeHandler;
        }
        else
        {
            this.warningTimeHandler();
        }
        this.birthBeanController = (BirthBeanController)this.getNetObject((int)(data["birthBeanController"]));
        this.refereeController   = (RefereeController)this.getNetObject((int)(data["refereeController"]));

        this.beans = new List <object>((object[])data["beans"]).ConvertAll <LoopBeanEntity>((object netId) => {
            return((LoopBeanEntity)this.getNetObject((int)(netId)));
        });
        this.persons = new List <object>((object[])data["persons"]).ConvertAll <PersonEntity>((object netId) => {
            return((PersonEntity)this.getNetObject((int)(netId)));
        });
        this.players = new List <object>((object[])data["players"]).ConvertAll <PlayerEntity>((object netId) => {
            return((PlayerEntity)this.getNetObject((int)(netId)));
        });

        this.bullets = new List <object>((object[])data["bullets"]).ConvertAll <BulletEntity>((object netId) => {
            return((BulletEntity)this.getNetObject((int)(netId)));
        });
        this.others = new List <object>((object[])data["others"]).ConvertAll <FightEntity>((object netId) => {
            return((FightEntity)this.getNetObject((int)(netId)));
        });


        //按照type顺序 进行初始化。 优先级 gemo->buff->actionBase->actionCommon->action->entity
        for (int i = 0, len = netObjectDatas.Count; i < len; i++)
        {
            int netId = (int)(netObjectDatas[i]["netId"]);
            this.getNetObject(netId).setData(netObjectDatas[i]);
        }
        this.birthGrids.createBirthGrids();
        ((ClientRunTime)this).localPlayer = (ClientPlayerEntity)this.getPlayer(((ClientRunTime)this).uid);
        //for(int i = 0, len = this.players.Count; i < len; i++) {
        //    ( (ClientPlayerEntity)this.players[i] ).build();
        //}

        //Biggo添加
        if (FightMain.isLocal)
        {
            this.aiController = new AIController(this);
        }


        for (int i = 0, len = this.players.Count; i < len; i++)
        {
            if (this.players[i] != ((ClientRunTime)this).localPlayer)
            {
                this.aiController.openAI(this.players[i], 1);
            }
        }
    }