Exemple #1
0
 void toDo()
 {
     if (player_name == "")         //if name is still zero, store it then get next line of the script
     {
         player_name    = message.Substring(0, 1).ToUpper() + message.Substring(1, message.Length - 1);
         script.index   = 0;
         script.section = 0;
         message        = script.getNextLine();
         message        = message.Substring(0, message.Length - 1) + player_name + "!\n";
         unlocked       = false;
     }
     else if (message == "help")
     {
         text.text += help;
         message    = "";
     }
     else if (message == "list")
     {
         text.text += list[script.section];
         message    = "";
     }
     else if (message.Length > 5 && message.Substring(0, 5) == "open ")
     {
         string temp = script.open(message.Substring(5));
         text.text  = text.text.Replace(temp, "");
         text.text += temp;
         message    = "";
     }
     else
     {
         string temp = script.getPassword().Replace(" ", "");
         if (!unlocked && (script.getPassword() == message.ToLower() ||
                           temp == message.ToLower()))           // if not unlocked
         {
             unlocked = true;
             message  = "";
             script.sectionChange();
             list_length = 0;
             unlocked    = false;
         }
         else
         {
             text.text += "Invalid command\n";
             message    = "";
         }
     }
 }