Esempio n. 1
0
        private static void ShowErrorMessage(BenchmarkClientComponent self, int errorCode)
        {
            string err = $"Session ErrorCode : {errorCode}";

            self.UserLog(err);
            Log.Error(err);
        }
Esempio n. 2
0
 public static void PrintMessage(this BenchmarkClientComponent self)
 {
     if (self.components.Count != 0)
     {
         for (int i = 0; i < self.components.Count; i++)
         {
             string msg = self.components[i].GetMessage();
             self.UserLog($"{msg}, Ping:{self.currentPing}, Name:{self.userName}");
         }
     }
 }
Esempio n. 3
0
 private static void HandleException(BenchmarkClientComponent self, Exception ex)
 {
     if (ex.InnerException is RpcException rpcEx)
     {
         ShowErrorMessage(self, rpcEx.Error);
     }
     else
     {
         string err = $"Message:{ex.InnerException.Message}\r\n{ex.InnerException.StackTrace}";
         self.UserLog(err);
         Log.Error(err);
     }
 }
Esempio n. 4
0
        public static void Init(this BenchmarkClientComponent self)
        {
            self.components.Clear();
            switch (self.robotMode)
            {
            case BenchmarkClientComponent.RobotMode.Roaming:
                self.RemoveComponent <RoamingBotModule>();
                self.RemoveComponent <MapUnitBotModule>();
                self.AddComponent <MapUnitBotModule>();
                self.components.Add(self.AddComponent <RoamingBotModule>());
                break;

            case BenchmarkClientComponent.RobotMode.Party:
                self.RemoveComponent <PartyBotModule>();
                self.RemoveComponent <MapUnitBotModule>();
                self.AddComponent <MapUnitBotModule>();
                self.components.Add(self.AddComponent <PartyBotModule>());
                break;

            default:
                throw new Exception($"clientSetting.robotMode:{self.robotMode} is not defined!");
            }
            self.UserLog("Reset client");
        }