Форум администраторов игровых серверов

Форум администраторов игровых серверов (https://forum.zone-game.info/TT.php)
-   Point Blank (Piercing Blow) (https://forum.zone-game.info/forumdisplay.php?f=204)
-   -   [Point Blank] Help Ready Battle (https://forum.zone-game.info/showthread.php?t=41681)

XRoro 14.11.2016 18:33

Help Ready Battle
 
what is wrong with this?
Please help me:(
@PROGRAMMATOR
@Awiion
[IMG]https://s21.postimg.org/p4hv3ut47/image.pngupload gifs[/IMG]

bola 14.11.2016 19:24

Re: Help Ready Battle
 
bad code identation at final of code, also post complete code on pastebin, developers still don't has developed technology of crystal ball.

PROGRAMMATOR 14.11.2016 22:00

Re: Help Ready Battle
 
At first we should find out where are the odd brackets from }}.
Then need to add property _playerList because probably:

Цитата:

The name '_playerList' does not exist in the current context
And the code must be written in C# style as you work with it.

private IList<Account> accounts = new List<Account>();
 
/// <summary>
/// Account join to room
/// </summary>
/// <param name="account"></param>
public void Join(Account account)
{
    // ...
 
    accounts.Add(account);
 
    // ...
}
 
/// <summary>
/// Get accounts by SlotState
/// </summary>
/// <param name="state"></param>
/// <returns></returns>
public IEnumerable<Account> GetAccounts(SlotState state)
{
    return Accounts.Where(x => x.Slot.HasState(state));
}
 
/// <summary>
/// Ready battle request
/// </summary>
/// <param name="account"></param>
public void ReadyBattleRequest(Account account)
{
    // ...
 
    if (slot.HasState(SlotState.Normal))
    {
        account.SetState(SlotState.Ready);
    }
    else
    {
        account.SetState(SlotState.Normal);
    }
 
    // ...
}
 
Code: C#

And use:

var accounts = GetAccounts(SlotState.Ready);
 
Code: C#

Awiion 15.11.2016 00:05

Re: Help Ready Battle
 
XRoro,
Part[2]:
Свернуть ↑Развернуть ↓

XRoro 15.11.2016 10:12

Re: Help Ready Battle
 
thanks for all your help :D


Текущее время: 21:19. Часовой пояс GMT +3.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd. Перевод: zCarot