Mac VisualStudio使用PlayerIO“找不到源”

时间:2018-07-23 12:36:33

标签: macos visual-studio

我正在在VisualStudio的highSierra,OSX和MacBook Air上为PlayerIO游戏编写机器人,实际上是Mac的MonoDevelop。我通过编辑.csproj文件将PIOClient依赖项连接到项目(运行良好)。该项目是一个控制台应用程序。它会打印出来,可以登录,但是缺少了后续步骤。这是Program.cs:

using System;
using System.Threading;
using System.Collections.Generic;
using PlayerIOClient;

namespace EEBot {
  class Program {
    public static Client _client;
    public static Connection _connection;

    // Edit this values
    public static string roomid = "PWiD05QMRyb0I"; //PWRngvmEVLQ

    static int BotId; // The Id of the Bot User
    static Dictionary < int, Player > Players = new Dictionary < int, Player > (); // All players in room
    static int cReport = 0; // Current Report
    static Dictionary < int, Report > Reports = new Dictionary < int, Report > (); // Reports

    //<-- GameTypes end -->//

    static void Main(string[] args) {
      PlayerIO.QuickConnect.SimpleConnect("everybody-edits-su9rn58o40itdbnw69plyw", "CENSORED E-MAIL", "CENSORED PASSWORD", null, loginSuccess, loginFail);
      Console.ReadKey();
    }

    static void loginSuccess(Client client) {
      _client = client;
      Console.WriteLine("Logged in!");
      client.Multiplayer.CreateJoinRoom(roomid, roomid.StartsWith("BW") ? "Beta" : "Everybodyedits" + client.BigDB.Load("config", "config")["version"], true, null, null, connectionSuccess, connectionFail);
    }
    static void loginFail(PlayerIOError error) {
      Console.WriteLine("Can't login, reason: " + error.Message);
    }

    static void connectionSuccess(Connection con) {
      _connection = con;
      Console.WriteLine("Connected!");
      _connection.Send("init");
      _connection.OnMessage += OnMessage;
    }

    private static void OnMessage(object sender, Message m) {
      switch (m.Type) {
        case "init":
          _connection.Send("init2");
          BotId = m.GetInt(5);
          break;
        case "init2":
          Console.WriteLine("Joined the room!");
          _connection.Send("say", "[Bot] Connected!");
          Thread.Sleep(100);
          _connection.Send("god", true);
          Thread.Sleep(100);
          _connection.Send("m", 320, 243, 0, 0, 0, 0, 0, 0, 0, false, false, 0);

          break;
        case "add":
          Player player = new Player(m.GetInt(0), m.GetString(1), m.GetString(2));
          Players.Add(player.Id, player);

          Console.ForegroundColor = ConsoleColor.Cyan;
          Console.WriteLine(m[1] + " in Room! (Rank " + Players[m.GetInt(0)].Rank + ")");
          Console.ForegroundColor = ConsoleColor.White;
          Console.WriteLine("\tId:" + m[0]);
          Console.WriteLine("\tId:" + m[2]);

          Thread.Sleep(100);
          if (m.GetString(3) == "simpleguest") {
            _connection.Send("say", "/kick " + Players[m.GetInt(0)].Username + " Please register!");
          }

          break;
        case "left":
          Console.ForegroundColor = ConsoleColor.Cyan;
          Console.WriteLine(Players[m.GetInt(0)].Username + " left!");
          Players.Remove(m.GetInt(0));
          break;
        case "info":
          Console.ForegroundColor = ConsoleColor.Cyan;
          Console.Write(m.GetInt(1));
          Console.ForegroundColor = ConsoleColor.Gray;
          Console.Write("Reason: ");
          Console.ForegroundColor = ConsoleColor.Magenta;
          Console.Write(m.GetInt(2));
          _connection.Disconnect();
          break;
        case "say":
          break;
      }
    }
    static void connectionFail(PlayerIOError error) {
      Console.WriteLine("Can't connect, reason: " + error.Message);
    }
  }
}

class Player {
  public int Id;
  public string Username;
  public int Rank;
  public bool Afk;

  public Player(int _Id, string _Username, string _ConnectId) {
    //General
    Id = _Id;
    Username = _Username;
    Afk = false;
    Rank = 1;
  }
}

class Report {
  public int Id;
  public int ByUser;
  public string Content;

  public Report(int _Id, int _ByUser, string _c) {
    Id = _Id;
    ByUser = _ByUser;
    Content = _c;
  }
}
  

显示“来源不可用”

0 个答案:

没有答案