Network.as 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. bool runServer = false;
  2. bool runClient = false;
  3. String serverAddress;
  4. uint16 serverPort = 1234;
  5. String userName;
  6. bool nobgm = false;
  7. void ParseNetworkArguments()
  8. {
  9. Array<String>@ arguments = GetArguments();
  10. for (uint i = 0; i < arguments.length; ++i)
  11. {
  12. String argument = arguments[i].ToLower();
  13. if (argument[0] == '-')
  14. {
  15. argument = argument.Substring(1);
  16. if (argument == "server")
  17. {
  18. runServer = true;
  19. runClient = false;
  20. }
  21. else if (argument == "address")
  22. {
  23. runClient = true;
  24. runServer = false;
  25. serverAddress = arguments[i + 1];
  26. ++i;
  27. }
  28. else if (argument == "username")
  29. {
  30. userName = arguments[i + 1];
  31. ++i;
  32. }
  33. else if (argument == "nobgm")
  34. nobgm = true;
  35. }
  36. }
  37. }