public void AnchorEnterRoom(AnchorManager _this, ulong charId, string name) { if (!_this.InAnchorRoomDic.ContainsKey(charId)) { _this.InAnchorRoomDic[charId] = name; _this.IsInAnchorRooml = 1; // 写日志 Logger.Info("Anchor Enter Room {0} id={1}", name, charId); } }
// 更新当前主播 private void UpdateCurrentAnchor(AnchorManager _this) { foreach (var anchorPair in _this.OnlineAnchorDict) { var anchor = anchorPair.Value; if (IsInLiveTime(anchor)) { var charId = anchorPair.Key; var name = anchor.Name; SetCurrentAnchor(_this, charId, name); } } }
// 增加在线主播 private void AddOnlineAnchor(AnchorManager _this, ulong charId, string name) { if (IsAnchor(_this, name)) { Anchor anchor; if (_this.MyConfig.AnchorDict.TryGetValue(name, out anchor)) { _this.OnlineAnchorDict[charId] = anchor; if (IsInLiveTime(anchor)) { SetCurrentAnchor(_this, charId, name); } } } }
public void AnchorExitRoom(AnchorManager _this, ulong charId) { if (!_this.InAnchorRoomDic.ContainsKey(charId)) { return; } // 写日志 Logger.Info("Anchor Exit Room id={0}", charId); _this.InAnchorRoomDic.Remove(charId); if (0 == _this.InAnchorRoomDic.Count) { // 写日志 _this.IsInAnchorRooml = 0; Logger.Info("Room is no Anchor!!!!!"); } }
// 设置当前主播 private void SetCurrentAnchor(AnchorManager _this, ulong charId, string name) { if (_this.CurrentAnchorId == charId) { return; } if (_this.CurrentAnchorId > 0) { // 下线了 } if (charId > 0) { // 上线了 ChatManager.BroadcastAllAnchorOnlineMessage(name, 1); } _this.CurrentAnchorId = charId; _this.CurrentAnchorName = name; }
public void LoadConfig(AnchorManager _this) { dynamic ServerConfig = JsonConfig.Config.ApplyJsonFromPath("../Config/anchor.config"); _this.MyConfig = new AnchorConfig(); _this.MyConfig.Open = (bool)ServerConfig.Open; _this.MyConfig.ServerName = (string)ServerConfig.ServerName; foreach (var val in ServerConfig.Anchors) { var anchor = new Anchor(); anchor.Name = val.Name; anchor.BeginTime = convertConfigToDateTime(val.BeginTime); anchor.EndTime = convertConfigToDateTime(val.EndTime); _this.MyConfig.AnchorDict[anchor.Name] = anchor; _this.MyConfig.AnchorBeginTimeDict[anchor.Name] = val.BeginTime; _this.MyConfig.AnchorEndTimeDict[anchor.Name] = val.EndTime; } _this.MyConfig.GuildSpeekLevel = (int)ServerConfig.GuildSpeekLevel; UpdateCurrentAnchor(_this); }
public List <string> GetAnchorBeginTimeList(AnchorManager _this) { var beginTimes = _this.MyConfig.AnchorBeginTimeDict.Values; return(beginTimes.ToList()); }
public List <string> GetAnchorNameList(AnchorManager _this) { var names = _this.MyConfig.AnchorDict.Keys; return(names.ToList()); }
public static int s_RefreshInterval = 60000; // ms public AnchorManager() { _instance = this; }
// 检查是否是主播 private bool IsAnchor(AnchorManager _this, string name) { return(_this.MyConfig.AnchorDict.ContainsKey(name)); }
public string GetCurrentAnchorName(AnchorManager _this) { return(_this.CurrentAnchorName); }
public ulong GetCurrentAnchor(AnchorManager _this) { return(_this.CurrentAnchorId); }