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; }
public void UpdateScore(int scores) { if (currSession == null) { return; } currSession.scores += scores; InfoUpdated?.Invoke(currSession); }
private void LoadGame() { _saveController.Load(out currSession); if (currSession == null) { currSession = new GameSession(); } InfoUpdated?.Invoke(currSession); }
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()); }
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}"); } }
private void ClearSaves() { _saveController.Clear(); currSession.scores = 0; InfoUpdated?.Invoke(currSession); }