示例#1
0
 // 这个是Client端的StartGame
 // Server的StartGame在PGame里
 public void StartGame(List <PGeneral> DefaultGenerals = null)
 {
     #region 初始化玩家列表
     PlayerList = new List <PPlayer>();
     for (int i = 0; i < PlayerNumber; ++i)
     {
         PlayerList.Add(new PPlayer()
         {
             Index     = i,
             Name      = PSystem.CurrentRoom.PlayerList[i].PlayerType.Equals(PPlayerType.Player) ? PSystem.CurrentRoom.PlayerList[i].Nickname : "P" + (i + 1).ToString(),
             IsAlive   = true,
             Money     = PPlayer.Config.DefaultMoney,
             TeamIndex = GameMode.Seats[i].Party - 1,
             Tags      = null
         });
         PBlock Position = Map.BlockList.Find((PBlock Block) => Block.StartPointIndex == i % Map.StartPointNumber);
         if (Position != null)
         {
             PlayerList[i].Position = Position;
         }
         else
         {
             PlayerList[i].Position = Map.BlockList[0];
         }
     }
     #endregion
     NowPlayer = null;
     NowPeriod = null;
 }
示例#2
0
        public async Task <IActionResult> PutPPeriod([FromRoute] int id, [FromBody] PPeriod pPeriod)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != pPeriod.Id)
            {
                return(BadRequest());
            }

            _context.Entry(pPeriod).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PPeriodExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
示例#3
0
        public async Task <IActionResult> PostPPeriod([FromBody] PPeriod pPeriod)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.Period.Add(pPeriod);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetPPeriod", new { id = pPeriod.Id }, pPeriod));
        }
示例#4
0
 public PStartPeriodOrder() : base("start_period",
                                   null,
                                   (string[] args) => {
     int NowPlayerIndex = Convert.ToInt32(args[1]);
     PPeriod Peroid     = FindInstance <PPeriod>(args[2]);
     if (Peroid != null)
     {
         PNetworkManager.NetworkClient.GameStatus.NowPeriod = Peroid;
         PAnimation.AddAnimation("切换阶段为[" + Peroid + "]", () => {
             PUIManager.GetUI <PMapUI>().PlayerInformationGroup.GroupUIList.ForEach((PPlayerInformationBox Box) => {
                 Box.PeriodText.gameObject.SetActive(false);
             });
             Text CurrentPeriodText = PUIManager.GetUI <PMapUI>().PlayerInformationGroup.GroupUIList[NowPlayerIndex].PeriodText;
             CurrentPeriodText.text = Peroid.IsFreeTime() ? "空闲时间点" : Peroid.Name;
             CurrentPeriodText.gameObject.SetActive(true);
             PUIManager.GetUI <PMapUI>().EndFreeTimeButton.interactable = Peroid.IsFreeTime() && NowPlayerIndex == PSystem.PlayerIndex;
         }, 1, Config.ChangePeriodTime);
     }
 }) {
 }
示例#5
0
    public bool IsAfter(PPeriod Another)
    {
        int Index1 = 0, Index2 = 0;

        for (int i = 0; i < PPeriodTriggerInstaller.TurnFlow.Length; ++i)
        {
            if (Equals(PPeriodTriggerInstaller.TurnFlow[i]))
            {
                Index1 = i;
            }
        }
        for (int i = 0; i < PPeriodTriggerInstaller.TurnFlow.Length; ++i)
        {
            if (Another.Equals(PPeriodTriggerInstaller.TurnFlow[i]))
            {
                Index2 = i;
            }
        }
        return(Index1 > Index2);
    }