Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
 // 更新当前主播
 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);
         }
     }
 }
Exemplo n.º 3
0
 // 增加在线主播
 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);
             }
         }
     }
 }
Exemplo n.º 4
0
        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!!!!!");
            }
        }
Exemplo n.º 5
0
        // 设置当前主播
        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;
        }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
        public List <string> GetAnchorBeginTimeList(AnchorManager _this)
        {
            var beginTimes = _this.MyConfig.AnchorBeginTimeDict.Values;

            return(beginTimes.ToList());
        }
Exemplo n.º 8
0
        public List <string> GetAnchorNameList(AnchorManager _this)
        {
            var names = _this.MyConfig.AnchorDict.Keys;

            return(names.ToList());
        }
Exemplo n.º 9
0
        public static int s_RefreshInterval = 60000;     // ms

        public AnchorManager()
        {
            _instance = this;
        }
Exemplo n.º 10
0
 // 检查是否是主播
 private bool IsAnchor(AnchorManager _this, string name)
 {
     return(_this.MyConfig.AnchorDict.ContainsKey(name));
 }
Exemplo n.º 11
0
 public string GetCurrentAnchorName(AnchorManager _this)
 {
     return(_this.CurrentAnchorName);
 }
Exemplo n.º 12
0
 public ulong GetCurrentAnchor(AnchorManager _this)
 {
     return(_this.CurrentAnchorId);
 }