protected override void HandlerButton(CommandMessages command) { switch (command) { case CommandMessages.pause: Time.timeScale = 0; break; case CommandMessages.play: Time.timeScale = 1; break; case CommandMessages.next: Next?.Invoke(); break; case CommandMessages.back: Back?.Invoke(); break; case CommandMessages.skip: Skip?.Invoke(); break; case CommandMessages.repeat: Repeat?.Invoke(); break; case CommandMessages.close: Application.Quit(); break; } }
protected virtual void TabletHandler(string content) { try { JObject message = JObject.Parse(content); Debug.LogError(message.ToString()); if (message.TryGetValue("request", out JToken value)) { string type = value.Value <string>("type"); switch (type) { case "setConfiguration": { JObject payload = value.Value <JObject>("payload"); Handler += () => { HandlerConfiguration(payload); }; break; } default: break; } } else if (message.TryGetValue("message", out value)) { JObject custom = value.Value <JObject>(); Handler += () => { ManageCustomCommand(custom); }; } else if (message.TryGetValue("event", out value)) { string type = value.Value <string>("type"); switch (type) { case "activityCommand": { string command = value.Value <JObject>("payload").Value <string>("command"); CommandMessages commandEnum = (CommandMessages)Enum.Parse(typeof(CommandMessages), command); Handler += () => { HandlerButton(commandEnum); }; break; } case "newPlayerSelected": { int id = value.Value <JObject>("payload").Value <int>("playerId"); Debug.Log(id); Handler += () => { HandlerTurn(id); }; break; } default: break; } } } catch (Exception e) { Debug.LogError(e); } }
protected virtual void HandlerButton(CommandMessages command) { }