From f6f75c69821c952aa1504aef1b07bd707e9f8089 Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Fri, 1 Apr 2016 23:52:13 +0200 Subject: [PATCH] more bomberman changes, doesn't work, not even close --- NadekoBot/Modules/Games/Commands/Bomberman.cs | 63 ++++++++++++++++++- NadekoBot/NadekoBot.csproj | 5 +- 2 files changed, 63 insertions(+), 5 deletions(-) diff --git a/NadekoBot/Modules/Games/Commands/Bomberman.cs b/NadekoBot/Modules/Games/Commands/Bomberman.cs index 0d2f9214..e2fba238 100644 --- a/NadekoBot/Modules/Games/Commands/Bomberman.cs +++ b/NadekoBot/Modules/Games/Commands/Bomberman.cs @@ -1,18 +1,75 @@ -using Discord.Commands; +using Discord; +using Discord.Commands; using NadekoBot.Commands; -using System; +using System.Linq; +using static NadekoBot.Modules.Games.Commands.Bomberman; namespace NadekoBot.Modules.Games.Commands { class Bomberman : DiscordCommand { + public Field[,] board = new Field[15, 15]; + + public BombermanPlayer[] players = new BombermanPlayer[4]; + + public Channel gameChannel; + + public Bomberman(DiscordModule module) : base(module) { + for (int i = 0; i < 15; i++) + { + for (int j = 0; j < 15; j++) + { + board[i, j] = new Field(); + } + } + NadekoBot.Client.MessageReceived += (s, e) => + { + if (e.Channel != gameChannel) + return; + + if (e.Message.Text == "a") + players.Where(p => p.User == e.User).FirstOrDefault()?.MoveLeft(); + }; } internal override void Init(CommandGroupBuilder cgb) { - throw new NotImplementedException(); + //cgb.CreateCommand(Module.Prefix + "bomb") + // .Description("Bomberman start") + // .Do(e => + // { + // if (gameChannel != null) + // return; + // gameChannel = e.Channel; + // players[0] = new BombermanPlayer + // { + // User = e.User, + // }; + // }); + } + + public class BombermanPlayer + { + public User User; + public string Icon = "👳"; + + internal void MoveLeft() + { + + } } } + + internal class Field + { + public BombermanPlayer player = null; + + public Field() + { + } + + public override string ToString() => player?.Icon ?? "⬜"; + } } diff --git a/NadekoBot/NadekoBot.csproj b/NadekoBot/NadekoBot.csproj index 81c190bb..d17ece46 100644 --- a/NadekoBot/NadekoBot.csproj +++ b/NadekoBot/NadekoBot.csproj @@ -130,6 +130,7 @@ + @@ -186,7 +187,8 @@ - + + @@ -478,7 +480,6 @@ Discord.Net -