Esempio n. 1
0
    public static void Serialize(this NetworkWriter writer, MaintenanceMessage value)
    {
        var json = PlayFab.PluginManager.GetPlugin <ISerializerPlugin>(PluginContract.PlayFab_Serializer);
        var str  = json.SerializeObject(value.ScheduledMaintenanceUTC);

        writer.Write(str);
    }
Esempio n. 2
0
    private void OnMaintenanceMessage(string msg_type, object body)
    {
        FunEncoding encoding = network_.GetEncoding(network_.GetDefaultProtocol());

        if (encoding == FunEncoding.kNone)
        {
            DebugUtils.Log("Can't find a FunEncoding type for maintenance message.");
            return;
        }

        if (encoding == FunEncoding.kProtobuf)
        {
            FunMessage msg = body as FunMessage;
            object     obj = network_.GetMessage(msg, MessageType.pbuf_maintenance);
            if (obj == null)
            {
                return;
            }

            MaintenanceMessage maintenance = obj as MaintenanceMessage;
            DebugUtils.Log("Maintenance message\nstart: {0}\nend: {1}\nmessage: {2}",
                           maintenance.date_start, maintenance.date_end, maintenance.messages);
        }
        else if (encoding == FunEncoding.kJson)
        {
            DebugUtils.Assert(body is Dictionary <string, object>);
            Dictionary <string, object> msg = body as Dictionary <string, object>;
            DebugUtils.Log("Maintenance message\nstart: {0}\nend: {1}\nmessage: {2}",
                           msg["date_start"], msg["date_end"], msg["messages"]);
        }
    }
Esempio n. 3
0
    private void OnMaintenanceMessage(MaintenanceMessage msg)
    {
        var message = msg;

        _messageWindow.Title.text   = "Maintenance Shutdown scheduled";
        _messageWindow.Message.text = string.Format("Maintenance is scheduled for: {0}", message.ScheduledMaintenanceUTC.ToString("MM-DD-YYYY hh:mm:ss"));
        _messageWindow.gameObject.SetActive(true);
    }
Esempio n. 4
0
    public static MaintenanceMessage Deserialize(this NetworkReader reader)
    {
        MaintenanceMessage msg = new MaintenanceMessage();

        var json = PlayFab.PluginManager.GetPlugin <ISerializerPlugin>(PluginContract.PlayFab_Serializer);

        msg.ScheduledMaintenanceUTC = json.DeserializeObject <DateTime>(reader.ReadString());

        return(msg);
    }
Esempio n. 5
0
        private static void ConfigureMaintenance(IServiceCollection services)
        {
            MaintenanceMessage message = new MaintenanceMessage()
            {
                Message   = "We are sorry, our Service is Unavailable right now !",
                RetryTime = 3200
            };

            services.AddMaintenance(() => false,
                                    Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(message)), "application/json", message.RetryTime);
        }
        void onMaintenanceMessage(object message)
        {
            if (encoding_ == FunEncoding.kJson)
            {
                JsonAccessor json_helper = FunapiMessage.JsonHelper;
                FunDebug.Log("Maintenance message\nstart: {0}\nend: {1}\nmessage: {2}",
                             json_helper.GetStringField(message, "date_start"),
                             json_helper.GetStringField(message, "date_end"),
                             json_helper.GetStringField(message, "messages"));
            }
            else if (encoding_ == FunEncoding.kProtobuf)
            {
                FunMessage msg = message as FunMessage;
                object     obj = FunapiMessage.GetMessage(msg, MessageType.pbuf_maintenance);
                if (obj == null)
                {
                    return;
                }

                MaintenanceMessage maintenance = obj as MaintenanceMessage;
                FunDebug.Log("Maintenance message\nstart: {0}\nend: {1}\nmessage: {2}",
                             maintenance.date_start, maintenance.date_end, maintenance.messages);
            }
        }