예제 #1
0
        public void InitPlayerAccount()
        {
            var autoSellItem = IniHelper.Account.GetString(Id.ToString(), "AutoSellItem");
            var spSellItem   = autoSellItem.Split('|');

            foreach (var item in spSellItem)
            {
                if (ushort.TryParse(item, out var id))
                {
                    AutoSellItemList.Add(id);
                }
            }
            var isAutoSell = IniHelper.Account.GetString(Id.ToString(), "IsAutoSell");

            if (bool.TryParse(isAutoSell, out var result))
            {
                IsAutoSell = result;
            }

            var isSellWhenFull = IniHelper.Account.GetString(Id.ToString(), "IsSellWhenFull");

            if (bool.TryParse(isSellWhenFull, out result))
            {
                IsSellWhenFull = result;
            }

            var autoDropItem = IniHelper.Account.GetString(Id.ToString(), "AutoDropItem");
            var spDropItem   = autoDropItem.Split('|');

            foreach (var item in spDropItem)
            {
                if (ushort.TryParse(item, out var id))
                {
                    AutoDropItemList.Add(id);
                }
            }
            var isAutoDrop = IniHelper.Account.GetString(Id.ToString(), "IsAutoDrop");

            if (bool.TryParse(isAutoDrop, out result))
            {
                IsAutoDrop = result;
            }

            var eventNoStr = IniHelper.Account.GetString(Id.ToString(), "WoodManEventNo");

            if (byte.TryParse(eventNoStr, out var eventNo))
            {
                _socket.WoodManInfo.EventNo = eventNo;
            }

            InfoUpdated?.Invoke();

            AutoSellItemUpdated?.Invoke();
            AutoDropItemUpdated?.Invoke();

            AutoSellItemUpdated += PlayerInfo_AutoSellItemUpdated;
            AutoDropItemUpdated += PlayerInfo_AutoDropItemUpdated;
        }
예제 #2
0
 public void UpdateScore(int scores)
 {
     if (currSession == null)
     {
         return;
     }
     currSession.scores += scores;
     InfoUpdated?.Invoke(currSession);
 }
예제 #3
0
 private void LoadGame()
 {
     _saveController.Load(out currSession);
     if (currSession == null)
     {
         currSession = new GameSession();
     }
     InfoUpdated?.Invoke(currSession);
 }
예제 #4
0
        private void ParseFileInfo()
        {
            TimeSpan fileDuration;

            FileStreams  = FFmpegParser.ParseFileInfo(output.ToString(), out fileDuration);
            FileDuration = fileDuration;
            if (Options.FrameCount > 0)
            {
                FrameCount = Options.FrameCount;
            }
            else if (VideoStream != null)
            {
                FrameCount = (int)(FileDuration.TotalSeconds * VideoStream.FrameRate);
            }
            InfoUpdated?.Invoke(this, new EventArgs());
        }
예제 #5
0
        public void OnEvent(EndpointSdkEvent endpointEvent)
        {
            Debug.Log($"Event {endpointEvent.Event} received by Endpoint {EndpointId}");
            if (endpointEvent.Event.Equals("Removed"))
            {
                Dispose();
                Removed?.Invoke(this);
            }
            else if (endpointEvent.Event.Equals("InfoUpdated"))
            {
                InfoUpdated?.Invoke(this);
            }
            else if (endpointEvent.Event.Equals("RemoteVideoStreamAdded"))
            {
                var eventArgs   = endpointEvent.GetEventArgs <EndpointRemoteVideoStreamAddedEventArgs>();
                var videoStream = CreateVideoStream(eventArgs.streamId);
                _videoStreams[eventArgs.streamId] = videoStream;
                eventArgs.VideoStream             = videoStream;

                RemoteVideoStreamAdded?.Invoke(this, eventArgs);
            }
            else if (endpointEvent.Event.Equals("RemoteVideoStreamRemoved"))
            {
                var eventArgs = endpointEvent.GetEventArgs <EndpointRemoteVideoStreamRemovedEventArgs>();
                if (!_videoStreams.ContainsKey(eventArgs.streamId))
                {
                    return;
                }

                var videoStream = _videoStreams[eventArgs.streamId];
                _videoStreams.Remove(eventArgs.streamId);

                eventArgs.VideoStream = videoStream;
                videoStream.Dispose();

                RemoteVideoStreamRemoved?.Invoke(this, eventArgs);
            }
            else
            {
                Debug.LogError($"Unexpected Event {endpointEvent.Event} for Endpoint {EndpointId}");
            }
        }
예제 #6
0
 private void ClearSaves()
 {
     _saveController.Clear();
     currSession.scores = 0;
     InfoUpdated?.Invoke(currSession);
 }