예제 #1
0
 /// <summary>
 /// Set the scene based chat relay at the start of every round
 /// </summary>
 public static void RegisterChatRelay(ChatRelay relay, Action <ChatEvent> serverChatMethod,
                                      Action <string, ChatChannel> clientChatMethod)
 {
     Instance.chatRelay        = relay;
     Instance.addChatLogServer = serverChatMethod;
     Instance.addChatLogClient = clientChatMethod;
 }
예제 #2
0
        public bool Start()
        {
            tas.Connected     += tas_Connected;
            tas.LoginDenied   += tas_LoginDenied;
            tas.LoginAccepted += tas_LoginAccepted;

            using (var db = new ZkDataContext()) {
                var acc = db.Accounts.FirstOrDefault(x => x.Name == GlobalConst.NightwatchName);
                if (acc != null)
                {
                    acc.SetPasswordPlain(config.AccountPassword);
                    acc.IsBot        = true;
                    acc.IsZeroKAdmin = true;
                    db.SaveChanges();
                }
            }

            Auth            = new AuthService(tas);
            adminCommands   = new AdminCommands(tas);
            offlineMessages = new OfflineMessages(tas);
            playerMover     = new PlayerMover(tas);
            SteamHandler    = new NwSteamHandler(tas, new Secrets().GetSteamWebApiKey());
            chatRelay       = new ChatRelay(tas, new Secrets().GetNightwatchPassword(), new List <string>()
            {
                "zkdev", "sy", "moddev"
            });

            PayPalInterface        = new PayPalInterface();
            PayPalInterface.Error += (e) =>
            { tas.Say(SayPlace.Channel, "zkdev", "PAYMENT ERROR: " + e.ToString(), true); };

            PayPalInterface.NewContribution += (c) =>
            {
                tas.Say(SayPlace.Channel,
                        "zkdev",
                        string.Format("WOOHOO! {0:d} New contribution of {1:F2}€ by {2} - for the jar {3}", c.Time, c.Euros, c.Name.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault(), c.ContributionJar.Name),
                        true);
                if (c.AccountByAccountID == null)
                {
                    tas.Say(SayPlace.Channel,
                            "zkdev",
                            string.Format("Warning, user account unknown yet, payment remains unassigned. If you know user name, please assign it manually {0}/Contributions", GlobalConst.BaseSiteUrl),
                            true);
                }
                else
                {
                    tas.Say(SayPlace.Channel,
                            "zkdev",
                            string.Format("It is {0} {2}/Users/Detail/{1}", c.AccountByAccountID.Name, c.AccountID, GlobalConst.BaseSiteUrl),
                            true);
                }
            };


            tas.Connect(config.ServerHost, config.ServerPort);

            return(true);
        }
예제 #3
0
    private char saysChar = ' ';     // This is U+200A, a hair space.

    private void Awake()
    {
        //ensures the static instance is cleaned up after scene changes:
        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            Destroy(gameObject);
        }
    }
예제 #4
0
    private char saysChar = ' ';     // This is U+200A, a hair space.

    private void Awake()
    {
        //ensures the static instance is cleaned up after scene changes:
        if (Instance == null)
        {
            Instance = this;
            Chat.RegisterChatRelay(Instance, PropagateChatToClients, AddToChatLogClient, AddPrivMessageToClient);
        }
        else
        {
            Destroy(gameObject);
        }
    }
예제 #5
0
 private void Awake()
 {
     //ensures the static instance is cleaned up after scene changes:
     if (Instance == null)
     {
         Instance = this;
         Chat.RegisterChatRelay(Instance, AddToChatLogServer, AddToChatLogClient);
     }
     else
     {
         Destroy(gameObject);
     }
 }