private void checkCurrentHealthStatus()
 {
     if (livePoints <= 0)
     {
         liveStatus = LiveStatus.dead;
     }
 }
 public void OnAuthComplete(LiveStatus status, LiveConnectSession session, Object userState)
 {
     try
     {
         source.SetResult(session);
     }
     catch (Exception ex)
     {
         source.TrySetException(ex);
     }
 }
Esempio n. 3
0
    public List <string> GetChannelsByStatus(LiveStatus s)
    {
        ids.Clear();
        foreach (var item in _curLiveStreamState)
        {
            if (item.Value == s)
            {
                ids.Add(item.Key);
            }
        }

        return(ids);
    }
Esempio n. 4
0
        public void Execute()
        {
            while (isAlive == LiveStatus.IsAlive && puzzle != null && IsPuzzleSolved() == false)
            {
                thisPercept = GetPerceptForRound();
                switch (thisPercept)
                {
                case Percepts.None:
                    Console.WriteLine("No strategy can be executed this round.");
                    Debug.WriteLine("No strategy can be exceuted this round.");
                    break;

                case Percepts.AreOnlyChoice:
                    onlyChoiceStrategy.AlgorithmInterface(ocTemp);
                    Console.WriteLine("Only Choice Strategy executed this round");
                    Debug.WriteLine("Only Choice Strategy executed this round.");
                    break;

                case Percepts.AreSinglePossibilities:
                    singlePossibilityStrategy.AlgorithmInterface(stTemp);
                    break;

                case Percepts.SubgroupExclusion:
                    subgroupExclusionStrategy.AlgorithmInterface(sgeTemp);
                    Console.WriteLine("Subgroup Exclusion executed this round");
                    Debug.WriteLine("Subgroup Exclusion executed this round.");
                    break;

                case Percepts.FindingNakedTwin:
                    nakedTwinExclusionStrategy.AlgorithmInterface(ntTemp);     //stuck on infinite loop here. THe issue appears to be that a list of twins are returned BUT none of the twin's neighbors have twin values as possibilities
                    Console.WriteLine("Naked Twin Strategy executed this round");
                    Debug.WriteLine("Naked Twin Strategy executed this round.");
                    break;

                //case Percepts.FindingHiddenTwin:
                //    hiddenTwinExclusionStrategy.AlgorithmInterface(htTemp);
                //    Console.WriteLine("Hidden Twin Strategy executed this round");
                //    Debug.WriteLine("Hidden Twin Strategy executed this round.");
                //    break;
                default:
                    break;
                }
                if (IsPuzzleSolved())   //execute this if statement at the end of the while loop
                {
                    isAlive = LiveStatus.IsDead;
                    //Draw Board?
                    Console.WriteLine("The puzzle is solved.");
                    CleanUp();
                }
            }
        }
 public override void Init(object args)
 {
     ChannelConfig = (ChannelConfig)args;
     youtubeLink  += ChannelConfig.channelId;
     Name.text     = ChannelConfig.name;
     _canClick     = true;
     monitor       = ResourcesManager.instance.CanMonitorChannel(ChannelConfig.channelId);
     status.text   = monitor ? "ON" : "OFF";
     mask.gameObject.SetActive(!_canClick);
     btnEvent.enabled = _canClick;
     btn.interactable = true;
     liveStatus       = HttpRequest.instance.GetLiveStatus(ChannelConfig.channelId);
     SetLiveStatusText();
 }
    public void Update()
    {
        float time = _nextClickTime - Time.realtimeSinceStartup;

        if (time > 0)
        {
            if (_canClick)
            {
                _canClick = false;
            }

            if (!_canClick)
            {
                mask.fillAmount = time / (HttpRequest.instance.updateInterval * 1.2f);
            }
            return;
        }
        else
        {
            if (!_canClick)
            {
                _canClick        = true;
                btn.interactable = _canClick;
                btnEvent.enabled = _canClick;
                TimerManager.instance.RemoveTimer(TimerId);
            }
        }
        var s = HttpRequest.instance.GetLiveStatus(ChannelConfig.channelId);

        if (s != liveStatus)
        {
            liveStatus = s;
            SetLiveStatusText();
        }

        //if (!monitor  && ResourcesManager.instance.CanMonitorChannel(ChannelConfig.channelId))
        //{
        //    monitor = true;
        //    status.text = monitor ? "ON" : "OFF";
        //}

        //if (monitor && !ResourcesManager.instance.CanMonitorChannel(ChannelConfig.channelId))
        //{
        //    monitor = false;
        //    status.text = monitor ? "ON" : "OFF";
        //}
    }
Esempio n. 7
0
 private void LoginCommand_Complete(LiveStatus liveStatus)
 {
     if (liveStatus.HasLoginErrors)
     {
         MessageBox.Show(liveStatus.LoginErrorMessage, "Live Login Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
     }
     else
     {
         this.liveAuthenticationToken  = liveStatus.Token;
         this.liveOperatingEnvironment = liveStatus.LiveOperatingEnvironment;
         this.loginName = this.liveOperatingEnvironment.Mesh.ProvisionedUser.Name;
         OnPropertyChanged("LiveOperatingEnvironment");
         OnPropertyChanged("LoginName");
         this.NeedsAuthentication = false;
         OnPropertyChanged("NeedsAuthentication");
     }
 }
Esempio n. 8
0
        public static LiveStream Get(int id, LiveStreamType type = LiveStreamType.Web)
        {
            var info = JObject.Parse(Utils.HttpGET("https://api.live.bilibili.com/room/v1/Room/room_init?id=" + id));

            if ((int)info["code"] != 0)
            {
                throw new Exception((string)info["message"]);
            }
            var stream = new LiveStream()
            {
                UserId     = (int)info["data"]["uid"],
                Id         = (int)info["data"]["room_id"],
                LiveStatus = (LiveStatus)(int)info["data"]["live_status"],
                Type       = type,
                Thread     = new()
            };

            if (stream.LiveStatus == LiveStatus.Live)
            {
                stream.LiveStartTime = Utils.GetDateTime((long)info["data"]["live_time"]);
            }
            else
            {
                return(stream);
            }
            string b     = $"https://api.live.bilibili.com/xlive/web-room/v1/playUrl/playUrl?https_url_req=1&ptype=16&platform={(type == LiveStreamType.Web ? "web" : "h5")}&cid={stream.Id}";
            var    info2 = JObject.Parse(Utils.HttpGET(b));

            if ((int)info2["code"] != 0)
            {
                throw new Exception((string)info2["message"]);
            }
            foreach (var data in (JArray)info2["data"]["quality_description"])
            {
                var thread = JObject.Parse(Utils.HttpGET(b + "&qn=" + data["qn"]));
                if ((int)thread["code"] != 0)
                {
                    throw new Exception((string)info2["message"]);
                }
                stream.Thread.Add(new LiveStreamThread((LiveStreamQuality)(int)thread["data"]["current_qn"], (JArray)thread["data"]["durl"]));
            }
            return(stream);
        }
Esempio n. 9
0
 protected virtual void SetCritterStatus(LiveStatus status)
 {
     _liveStatus = status;
 }
Esempio n. 10
0
 public void Init()
 {
     isAlive = LiveStatus.IsAlive;
 }
Esempio n. 11
0
 public Agent()
 {
     isAlive = LiveStatus.IsDead;
     Console.WriteLine("Agent Created.");
 }
Esempio n. 12
0
 public async Task GetLiveSeaerchResultAsync(string keyword, LiveStatus liveStatus)
 {
     var res = await _searchClient.Live.GetLiveSearchPageScrapingResultAsync(LiveSearchOptionsQuery.Create(keyword, liveStatus), default(CancellationToken));
 }