Пример #1
0
 public IActionResult GetPublishLogByUserToken(PublishLog publishLog)
 {
     try
     {
         long User_id           = Convert.ToInt64(User.Claims.Where(x => x.Type == "user_id").FirstOrDefault().Value);
         List <PublishLog> list = con.PublishLog.FromSql($"[dbo].[usp_GetPublishLogByUserToken] {publishLog.token},{User_id}").ToList();
         return(Ok(list));
     }
     catch (Exception e)
     {
         return(StatusCode(500, e.Message));
     }
 }
Пример #2
0
    public void GameStart()
    {
        if (!Application.isEditor)
        {
            PublishLog.Open();
        }
        SaveLoadManager.Delete(SaveLoadManager.tagSL.Del_Auto);
        this.Init();
        if (Application.loadedLevelName != "Start" && Application.loadedLevelName != "Landing" && Application.loadedLevelName != "End" && Application.loadedLevelName != "Credits")
        {
            this.InitScene();
            GameTime.Init();
        }
        if (Application.loadedLevelName == "Landing")
        {
            this.PlayGameBgSound();
        }
        if (Application.loadedLevelName != "Start" && Application.loadedLevelName != "Landing" && Application.loadedLevelName != "End" && Application.loadedLevelName != "Credits")
        {
            GUIControl.MovieClose();
            this.EnterScene();
            Singleton <CResourcesStaticManager> .GetInstance();

            EZGUIManager._BindRunTimeObj.AddRunGUIEx();
        }
        if (Application.loadedLevelName == "Landing")
        {
            EZGUIManager._BindRunTimeObj.AddLandUI();
            this.ReStartGame(true);
        }
        else
        {
            EZGUIManager._BindRunTimeObj.RemoveLandUI();
        }
        if (Application.loadedLevelName == "End" || Application.loadedLevelName == "Credits")
        {
            this.ReStartGame(false);
        }
        Main.Instance.DelayGC(20f);
    }
Пример #3
0
        public IActionResult sendToDevice(PublishLog publishLog)
        {
            try
            {
                MqttClient client = new MqttClient(_config["MqttConfig:Mqtt_Server"]);

                client.MqttMsgSubscribed   += client_MqttMsgSubscribed;
                client.MqttMsgUnsubscribed += client_MqttMsgUnsubscribed;

                client.MqttMsgPublishReceived += client_MqttMsgPublishReceived;

                client.MqttMsgPublished += client_MqttMsgPublished;

                client.Connect(Guid.NewGuid().ToString());

                string topic = _config["MqttConfig:Publish_Topic"] + publishLog.token;

                string[] topicName = { topic };

                byte[] qosLevels = { MqttMsgBase.QOS_LEVEL_AT_MOST_ONCE };
                client.Subscribe(topicName, qosLevels);

                string jsonDataToSend = publishLog.message;

                client.Publish(topicName.FirstOrDefault(), Encoding.UTF8.GetBytes(jsonDataToSend));

                //client.Unsubscribe(topicName);

                long         User_id = Convert.ToInt64(User.Claims.Where(x => x.Type == "user_id").FirstOrDefault().Value);
                ResultObject result  = con.ResultObject.FromSql($"[dbo].[usp_CreatePublishLog] {publishLog.token},{User_id},{publishLog.message}").FirstOrDefault();

                return(Ok(result));
            }
            catch (Exception e)
            {
                return(StatusCode(500, e.Message));
            }
        }