Beispiel #1
0
    void CmdStartGame()
    {
        GameObject   serverObj = GameObject.Find("ServerObj");
        ServerScript server    = serverObj.GetComponent <ServerScript> ();

        server.startGame();
    }
 public static ErrorData OnCreating(Context context, ServerScript serverScript)
 {
     try
     {
         ServerScriptUtilities.Execute(
             context: context,
             ss: new SiteSettings
         {
             EditorColumnHash = new Dictionary <string, List <string> >(),
             ColumnHash       = new Dictionary <string, Column>()
         },
             itemModel: new BaseItemModel(),
             view: null,
             scripts: new ServerScript[]
         {
             serverScript
         });
     }
     catch (Exception ex)
     {
         while (ex.InnerException != null)
         {
             ex = ex.InnerException;
         }
         return(new ErrorData(type: Error.Types.IncorrectServerScript, data: ex.Message));
     }
     return(new ErrorData(type: Error.Types.None));
 }
Beispiel #3
0
        public async Task <string> CallServerScript(ServerScript script, CancellationToken token)
        {
            string uriString     = $"{BaseUrl}:{PortNumber}{String.Format(CALL_SCRIPT_ENDPOINT, script.Name)}";
            Uri    callScriptUri = new Uri(uriString);

            try
            {
                HttpResponseMessage response = await _client.GetAsync(callScriptUri).AsTask(token);

                if (response.IsSuccessStatusCode)
                {
                    string responseBody = await response.Content.ReadAsStringAsync();

                    return(responseBody);
                }
                else
                {
                    return("");
                }
            }
            catch (COMException ex)
            {
                System.Diagnostics.Debug.WriteLine("CallScripts failed because: " + ex.ToString());
                return(ex.ToString());
            }
        }
Beispiel #4
0
 public ServerScriptVm(ServerScript b)
 {
     this.Name               = b.Name;
     this.RelativePath       = b.RelativePath;
     this.ScriptKind         = b.ScriptKind;
     this.IsLoading          = false;
     this.LastServerResponse = "";
 }
        public void AddNewUser(Player player)
        {
            Debug.WriteLine("Create a new User");
            string         url       = Strings.uuids;
            string         reason    = Strings.request_uuids;
            PlayerDocument newplayer = new PlayerDocument(player.Name, player.EndPoint);

            ServerScript.TriggerEvent("Server:HttpGet", url, reason, newplayer);
        }
Beispiel #6
0
    public void Authentication()
    {
        ServerScriptData data = ServerScript.GetServerData(inputField.text);

        if (data != null)
        {
            client.Connect(data.ip, 7000);
        }
    }
 public void GetPlayerInfo()
 {
     foreach (DatabaseRows document in rows)
     {
         string url = Strings.player_base + "/" + document.id.ToString();
         Debug.WriteLine("Getting entry from " + url);
         string reason = Strings.get_single_player_doc;
         ServerScript.TriggerEvent("Server:HttpGet", url, reason);
     }
 }
Beispiel #8
0
    IEnumerator Start()
    {
        theScript = serverScript.GetComponent <ServerScript>();

        while (!theScript.startButtonClicked)
        {
            yield return(null);
        }
        startButtonClickTime = Time.timeSinceLevelLoad;
        timerText            = GetComponent <Text>() as Text;
    }
Beispiel #9
0
    void CmdLocate(float longit, float latit, bool provideLoc, bool offProv)
    {
        GameObject   serverObj = GameObject.Find("ServerObj");
        ServerScript server    = serverObj.GetComponent <ServerScript> ();

        if (provideLoc)
        {
            server.setLoc(longit, latit);
        }
        offset = server.Offset(longit, latit, offProv);
    }
        public void UploadNewUser(dynamic response, dynamic param)
        {
            string uuid = response.uuids[0];

            Debug.WriteLine("Got a new Universal Unique Identifier: " + uuid);
            // UUIDs are currently only used for generating new documents (for new users...).
            // The implementation will change at a later stage but atm it's the easiest.
            string url    = Strings.player_base + "/" + uuid;
            string reason = ""; /*i dont need a callback*/

            ServerScript.TriggerEvent("Server:HttpPut", url, param, reason);
        }
 void Update()
 {
     if (!isServer)
     {
         return;
     }
     if (numLeft < 12)
     {
         crumbled = true;
         GameObject   serverObj = GameObject.Find("ServerObj");
         ServerScript server    = serverObj.GetComponent <ServerScript> ();
         server.endGame();
     }
 }
Beispiel #12
0
 void Awake()
 {
     try
     {
         ServerAddress = System.IO.File.ReadAllText(Application.streamingAssetsPath + "/ServerAddress.txt");
         Debug.Log("Connected");
     }
     catch
     {
         System.IO.File.WriteAllText(Application.streamingAssetsPath + "/ServerAddress.txt", "[Server Address]");
         ServerAddress = "ERROR";
         Debug.Log("ERROR");
     }
     Instance = this;
 }
Beispiel #13
0
    void Awake()
    {
        //gets reference to server to be able to send messages
        m_serverScript = this.gameObject.transform.parent.gameObject.GetComponent <ServerScript>();

        //sets room and players
        Capacity            = 2;
        m_numPlayers        = 0;
        m_bMatchStarted     = false;
        m_bGameSet          = false;
        m_players           = new string[2];
        m_CurrentPlayerTurn = -1; //initialized to -1 for safety purposes

        //Board setup
        m_slots = new string[42];
        for (int i = 0; i < m_slots.Length; ++i)
        {
            m_slots[i] = "";
        }
    }
Beispiel #14
0
 private void Start()
 {
     player1IpText.text = ServerScript.GetPlayerHexIP(1);
     player2IpText.text = ServerScript.GetPlayerHexIP(2);
     serverScript       = GetComponent <ServerScript>();
 }
 public override void Request()
 {
     ServerScript.TriggerEvent("Server:HttpGet", Strings.couchdb_url, Strings.reason_connectivity);
 }
Beispiel #16
0
 public static ErrorData OnCreating(Context context, ServerScript serverScript)
 {
     return(new ErrorData(type: Error.Types.None));
 }
Beispiel #17
0
 public static ErrorData OnUpdating(Context context, ServerScript serverScript)
 {
     return(OnCreating(
                context: context,
                serverScript: serverScript));
 }
Beispiel #18
0
 // Use this for initialization
 void Start()
 {
     instance = this;
     if(Network.isServer) {
         severScript = GameObject.Find("Server").GetComponent<ServerScript>();
     }
 }
Beispiel #19
0
 public override void Request()
 {
     ServerScript.TriggerEvent("Server:HttpGet", Strings.player_doc_url, Strings.get_player_docs);
 }