Exemple #1
0
        public Resources()
        {
            Configuration = new Configuration();
            Configuration.Initialize();

            _logger = new Logger();

            Csv         = new Csv();
            Fingerprint = new Fingerprint();

            _mysql               = new MySQL();
            _messagefactory      = new MessageFactory();
            _commandfactory      = new CommandFactory();
            _debugcommandfactory = new DebugCommandFactory();
            _apiService          = new ApiService();

            Levels           = new Levels();
            PlayerCache      = new PlayerCache();
            AllianceCache    = new AllianceCache();
            LeaderboardCache = new LeaderboardCache();

            ChatManager = new LogicGlobalChatManager();

            Gateway = new Gateway();
        }
Exemple #2
0
        private void PrintNewTopScorer(PlayerCache playerCache)
        {
            if (_lastTopScorer == null)
            {
                _lastTopScorer = playerCache.Player.Clone();
                //foreach (var player in _rconClient.PlayerListCommand.GetPlayers())
                //{
                //    if (_lastTopScorer == null || player.Score.Score > _lastTopScorer.Score.Score)
                //        _lastTopScorer = player;
                //}
            }

            if (_lastTopScorer.Name != playerCache.Player.Name && playerCache.Player.Score.Score > _lastTopScorer.Score.Score)
            //if (playerCache.Player.Score.Score > _lastTopScorer.Score.Score)
            {
                if (_canReportTopScoreAndKill && playerCache.Player.Score.Score > _minimumScoreToReportTopScorer)
                {
                    if (!playerCache.Settings.StopSpam)
                    {
                        _rconClient.SendMessagePlayer(playerCache.Player,
                                                      "KD: You just replaced " + _lastTopScorer.Name +
                                                      " as top scorer this round.");
                    }
                    var other = playerEvents.GetPlayerCache(_lastTopScorer);
                    if (other != null && !other.Settings.StopSpam)
                    {
                        _rconClient.SendMessagePlayer(_lastTopScorer,
                                                      "KD: You just got replaced as top scorer by " +
                                                      playerCache.Player.Name +
                                                      ".");
                    }
                }
                _lastTopScorer = playerCache.Player.Clone();
            }
        }
Exemple #3
0
        private void PlayerListCommandOnPlayerJoined(object sender, Player player)
        {
            lock (_players)
            {
                // Add player to our cache

                //var pcs = (from pc in _playerStorage.PlayerCaches
                //          where pc.Player.Name == player.Name
                //          select pc).ToList<PlayerCache>();
                //PlayerCache dPlayer;
                //if (pcs.Count != 0)
                //{
                //    dPlayer = pcs.First();
                //    dPlayer.Player = player;
                //}
                //else
                //{
                //    // Create PlayerCache in DB and save
                var dPlayer = new PlayerCache();
                dPlayer.Player = player;
                //_playerStorage.PlayerCaches.Add(dPlayer);
                //try
                //{
                //    _playerStorage.SaveChanges();
                //}
                //catch (Exception exception)
                //{
                //    Debug.WriteLine(exception.ToString());
                //}
                //}

                _players.Add(player, dPlayer);
            }
        }
Exemple #4
0
    public void UpdateUI(RebateDialDto rebateDialDto)
    {
        if (rebateDialDto != null)
        {
            if (rebateDialDto.position.Count > 0)
            {
                isPlayerAni = true;
                resultIndex = rebateDialDto.position[0] - 1;
                if (rebateDialInfoDto.canGetCount > 0)
                {
                    rebateDialInfoDto.canGetCount--;

                    drawCount.text = drawCount.text = "剩余次数(" + rebateDialInfoDto.canGetCount + ")";
                    rebateDialInfoDto.getCounted++;
                    alreadyTimes.text = rebateDialInfoDto.getCounted.ToString();
                }
                else
                {
                    drawBtn.interactable = false;
                }
                PlayerCache.SetWealthUpdate(rebateDialDto.items, false);
                StartCoroutine(StartPlayAni(rebateDialDto));
            }
        }
    }
    protected override IEnumerator Execute()
    {
        SetState(NodeState.RUNNING);

        // Fail action if item is out of reach
        if (!senses.IsItemInReach(itemToCollect))
        {
            SetState(NodeState.FAILURE);
            yield break;
        }

        actions.CollectItem(itemToCollect);

        // Check if agent acidentally thinks he picked up item but is not actually in his inventory
        if (!inventory.HasItem(itemToCollect.name.ToString()))
        {
            SetState(NodeState.FAILURE);
            yield break;
        }

        PlayerCache.SetFlagCarriers(itemToCollect);

        SetState(NodeState.SUCCESS);

        yield return(null);
    }
Exemple #6
0
        private void PrintKillLabel(PlayerCache playerCache)
        {
            // Print some simple kill stats to player and all when at certain threshold

            // Did player kill someone?
            if (playerCache.LastPlayerDelta.Score.Kills < 1)
            {
                return;
            }


            var historyItems = new List <PlayerHistoryItem>(GetHistory(playerCache, _killPeriodLookbehind));

            if (historyItems.Count() == 0)
            {
                return;
            }

            if (_lookingForFirstKill)
            {
                _lookingForFirstKill = false;
                _rconClient.SendMessageAll("KD: First kill: " + playerCache.Player.Name + " in " + _rconClient.ServerInfoCommand.ServerInfo.ElapsedRoundTime + " seconds.");
            }

            int               kills        = 0;
            DateTime          oldestUpdate = default(DateTime);
            PlayerHistoryItem lastWithKill = null;

            foreach (var historyItem in historyItems)
            {
                kills += historyItem.PlayerDelta.Score.Kills;
                if (historyItem.PlayerDelta.Score.Kills > 0)
                {
                    lastWithKill = historyItem;
                }
            }
            // Last kill watch
            if (lastWithKill != null)
            {
                oldestUpdate = lastWithKill.Player.LastUpdate;
                _lastKills.Enqueue(lastWithKill);
            }
            // Last kill queue length limit
            while (_lastKills.Count > _lastkillsLength)
            {
                _lastKills.Dequeue();
            }

            var timeSinceOldest = DateTime.Now.Subtract(oldestUpdate);

            // Message player
            if (kills >= _reportKillsToPersonAt && !playerCache.Settings.StopSpam)
            {
                _rconClient.SendMessagePlayer(playerCache.Player, "KD: Last " + (int)timeSinceOldest.TotalSeconds + " seconds: " + kills + " kills.");
            }
            if (kills >= _reportKillsToAllAt)
            {
                _rconClient.SendMessageAll("KD: " + playerCache.Player.Name + " has " + kills + " kills in just " + (int)timeSinceOldest.TotalSeconds + " seconds.");
            }
        }
Exemple #7
0
        public Resources()
        {
            Configuration = new Configuration();
            Configuration.Initialize();

            _logger = new Logger();

            Csv         = new Csv();
            Fingerprint = new Fingerprint();

            _mysql = new MySQL();

            if (!string.IsNullOrEmpty(Configuration.RedisPassword) && !string.IsNullOrEmpty(Configuration.RedisServer))
            {
                _redis = new Redis();
            }

            _messagefactory      = new LogicMagicMessageFactory();
            _commandfactory      = new LogicCommandManager();
            _debugcommandfactory = new DebugCommandFactory();

            Levels           = new Levels();
            PlayerCache      = new PlayerCache();
            AllianceCache    = new AllianceCache();
            LeaderboardCache = new LeaderboardCache();

            ChatManager = new LogicGlobalChatManager();

            Gateway = new Gateway();
        }
Exemple #8
0
 static Caches()
 {
     User   = new UserCache();
     Player = new PlayerCache();
     Match  = new MatchRoomCache();
     Select = new SelectRoomCache();
     Battle = new BattleRoomCache();
 }
Exemple #9
0
        protected virtual void OnPlayerUpdated(PlayerCache playerCache)
        {
            PlayerUpdatedDelegate handler = PlayerUpdated;

            if (handler != null)
            {
                handler(this, playerCache);
            }
        }
Exemple #10
0
        /// <summary>
        /// 结算通知   bonus:中奖金额
        /// </summary>
        /// <param name="bonus"></param>
        public override void settleAccount(long bonus, int timer)
        {
            GameObject   go           = GameTools.Instance.GetObject("Prefabs/TianTianLe/TTLAwardPanel");
            GameObject   obj          = UnityEngine.GameObject.Instantiate(go);
            AHResultMono aHResultMono = obj.AddComponent <AHResultMono>();

            obj.transform.SetParent(PlayerCache.GetCanvas());
            aHResultMono.SelfWin(bonus);
        }
Exemple #11
0
 //返回按钮点击事件
 private void BackBtnOnClick()
 {
     if (isPlayerAni)
     {
         XUIMidMsg.QuickMsg("转盘转动中哟");
         return;
     }
     transform.gameObject.SetActive(false);
     PlayerCache.WealthUpdate();
 }
Exemple #12
0
 public static string GetPlayerName(int playerId)
 {
     if (PlayerCache.TryGetValue(playerId, out var playerName))
     {
         return(playerName);
     }
     playerName = KReader.getGNameFromId(playerId);
     PlayerCache.Add(playerId, playerName);
     return(playerName);
 }
Exemple #13
0
 public void UpdateUIData(BankDto bankDto)
 {
     currentGoldTxt.text        = bankDto.holdGold.ToString();
     walletGoldTxt.text         = bankDto.bankResiduceGold.ToString();
     totalGoldTxt.text          = (bankDto.holdGold + bankDto.bankResiduceGold).ToString();
     DepositInput.text          = "1";
     ExtractInput.text          = "1";
     PlayerCache.loginInfo.gold = bankDto.holdGold;
     PlayerCache.WealthUpdate();
 }
Exemple #14
0
        private void PlayerEventsOnPlayerUpdated(object sender, PlayerCache playerCache)
        {
            PrintScore(playerCache);
            PrintKillLabel(playerCache);
            PrintDeathLabel(playerCache);
            PrintSuicideLabel(playerCache);
            PrintTooHighKD(playerCache);

            PrintNewTopKiller(playerCache);
            PrintNewTopScorer(playerCache);
        }
Exemple #15
0
        /// <summary>
        ///  有人請求添加为好友 uid:請求人的uid,userName:請求人的用户名
        /// </summary>
        /// <param name="uid"></param>
        /// <param name="userName"></param>
        public override void hasFriendRequest(long uid, string userName)
        {
            GameObject go  = GameTools.Instance.GetObject("Prefabs/Friend/AddFriendTipsPanel");
            GameObject obj = GameObject.Instantiate(go);

            obj.transform.SetParent(PlayerCache.GetCanvas());
            obj.transform.localScale = Vector3.one;
            AddFriendTipPanel tips = obj.AddComponent <AddFriendTipPanel>();

            tips.SetContent(uid, userName);
        }
Exemple #16
0
        private void PrintSuicideLabel(PlayerCache playerCache)
        {
            // Print some simple kill stats to player and all when at certain threshold

            // Did player kill someone?
            if (playerCache.LastPlayerDelta.Score.Suicides < 1)
            {
                return;
            }

            _rconClient.SendMessageAll("KD: " + playerCache.Player.Name + " suicided.");
        }
Exemple #17
0
 // Start is called before the first frame update
 void Start()
 {
     messageTarget = s => ReciveMessage(s);
     manager       = ChatManager.GetInstance();
     inputText     = manager.inputText;
     chat          = Socket.Connect(ServerHelper.SERVERPATH + "/" + SocketEvent.chat.ToString());
     playerInfo    = PlayerCache.GetInstance();
     chat.On("connect", () => {
         Debug.Log("채팅 서버 접속" + chat.IsConnected);
         chat.On(SocketEvent.chat.ToString(), messageTarget);
     });
 }
Exemple #18
0
    //奖品信息显示协程
    IEnumerator AwardActive(int a)
    {
        if (a == 0)
        {
            yield return(new WaitForSeconds(1f));

            StartCoroutine(ArowsShan());

            //显示出获得的奖品名称
            // awardText.text = "恭喜您获得了" + wrap.PrizeName;
            Sprite sprite;
            if (wrap.AwardID == 1)
            {
                sprite = GameTools.Instance.GetSpite("Sprite/Common/cGold");
            }
            else
            {
                sprite = GameTools.Instance.GetSpriteAtlas("Sprite/StoreGoodsIma/StoreGoodsAtlas", wrap.AwardID.ToString());
            }
            AwardPanel.GetChild(0).GetComponent <Image>().sprite = sprite;
            AwardPanel.GetChild(1).GetComponent <Text>().text    = "X" + SignInDialDataTable.get(wrap.Position).count;
            AwardPanel.gameObject.SetActive(true);
            AwardPanel.localScale = new Vector3(0, 1, 0);
            AwardPanel.DOScale(Vector3.one, 0.5f);
            yield return(new WaitForSeconds(2f));

            AwardPanel.gameObject.SetActive(false);
            if (PlayerCache.loginInfo.signInDialNum > 0)
            {
                goBtn.interactable = true;
                goimg.color        = Color.white;
            }
            else
            {
                goBtn.interactable = false;
                goimg.color        = Color.gray;
            }
        }
        if (a == 1)
        {
            //显示出领取到的奖品信息
            awardText.text = "恭喜你获得了金币" + AwardCountList[PlayerCache.loginInfo.signInDay].gold +
                             " 换牌卡x" + AwardCountList[PlayerCache.loginInfo.signInDay].changeCard;

            PlayerCache.WealthUpdate();
            tishiPanel.SetActive(true);
        }
        yield return(new WaitForSeconds(1.5f));

        tishiPanel.SetActive(false);
    }
Exemple #19
0
        private void PrintScore(PlayerCache playerCache)
        {
            // Print some simple kill stats to player and all when at certain threshold
            if (playerCache.LastPlayerDelta.Score.Score < 1)
            {
                return;
            }
            var lastReportedTime = DateTime.Now.Subtract(playerCache.LastScoreReportedTime);

            // Waiting since last report?
            if (lastReportedTime < _scoreReportDelay)
            {
                return;
            }

            var historyItems = new List <PlayerHistoryItem>(GetHistory(playerCache, _scoreReportHistory));

            if (historyItems.Count() == 0)
            {
                return;
            }
            DateTime oldestUpdate = historyItems.Last().Player.LastUpdate;
            //DateTime newestUpdate = historyItems.Last().Player.LastUpdate;
            var timeSinceOldest = DateTime.Now.Subtract(oldestUpdate);
            //var timeSinceNewest = DateTime.Now.Subtract(newestUpdate);

            int score = 0;

            foreach (var historyItem in historyItems)
            {
                score += historyItem.PlayerDelta.Score.Score;
                //if (score > _minimumScoreToReport)
                //    return;
            }
            var oldestSec = (int)timeSinceOldest.TotalSeconds;

            // Message player
            if (!playerCache.Settings.StopSpam && score > _minimumScoreToReport && score > playerCache.LastScoreReported - lastReportedTime.TotalSeconds)
            {
                //var tmpScore = playerCache.LastScoreReported;
                playerCache.LastScoreReported     = score;
                playerCache.LastScoreReportedTime = DateTime.Now;
                //score -= tmpScore;

                if ((int)timeSinceOldest.TotalSeconds != 0)
                {
                    _rconClient.SendMessagePlayer(playerCache.Player,
                                                  "KD: Score last " + (int)_scoreReportHistory.TotalSeconds + " seconds: " + score);
                }
            }
        }
    // Start is called before the first frame update
    void Start()
    {
        // Factory
        CardFactory      cardFactory      = new CardFactory();
        CharacterFactory characterFactory = new CharacterFactory(cardFactory);

        // Cache
        PlayerCache     playerCache     = new PlayerCache();
        CacheCollection cacheCollection = new CacheCollection(playerCache);

        playerCache.ActiveCharacter = characterFactory.GetCharacter(CharacterType.Warrior);

        cardList.Setup(playerCache.ActiveCharacter.Type);
    }
Exemple #21
0
 public void Dispose()
 {
     //Csv = null;
     Gateway              = null;
     PlayerCache          = null;
     Configuration        = null;
     Levels               = null;
     Fingerprint          = null;
     _messagefactory      = null;
     _commandfactory      = null;
     _debugcommandfactory = null;
     _mysql               = null;
     _apiService          = null;
 }
Exemple #22
0
 //获取在场玩家信息
 private void OtherPlayerOnclick(int num)
 {
     //获取人物信息
     if (roomPlayerBasedtos != null)
     {
         if (roomPlayerBasedtos.list[num].uid == PlayerCache.loginInfo.uid)
         {
             XUIMidMsg.QuickMsg("亲,这是您自己哦。调皮");
         }
         else
         {
             PlayerCache.LookOtherPlayerInfo(roomPlayerBasedtos.list[num].uid);
         }
     }
 }
Exemple #23
0
    /// <summary>
    /// 收货
    /// </summary>
    private void BtnHarvestOnClick()
    {
        AudioManager.Instance.PlaySound("button");
        MoneyTreeAwardDto moneyTreeAwardDto = moneyTreeOperation.award(PlayerCache.loginInfo.uid);

        if (moneyTreeAwardDto != null)
        {
            PlayerCache.loginInfo.gold = moneyTreeAwardDto.holdGold;
            PlayerCache.WealthUpdate();
            timer.text     = "0小时/12小时";
            goldcount.text = "0";
            slider.value   = 0f;
            btn_Harvest.gameObject.SetActive(false);
        }
    }
Exemple #24
0
 //获取在座玩家人物信息
 private void GetOtherPlayerinfo(int seat)
 {
     //获取人物信息
     foreach (var item in PlayerCache.SeatPlayerinfoDic.Values)
     {
         if (item.position == seat)
         {
             if (item.uid != PlayerCache.loginInfo.uid)
             {
                 PlayerCache.LookOtherPlayerInfo(item.uid);
                 break;
             }
         }
     }
 }
Exemple #25
0
        public override void bet2CallBack(LotteryBetDto callBackParam)
        {
            if (callBackParam != null)
            {
                PlayerCache.loginInfo.gold = callBackParam.reduceGold;
                UIHallManager     uIHallManager     = MessageManager.GetInstance.GetUIDict <UIHallManager>();
                UITianTianLePanel uITianTianLePanel = MessageManager.GetInstance.GetUIDict <UITianTianLePanel>();
                if (uITianTianLePanel != null)
                {
                    uITianTianLePanel.UpdateBetNum(callBackParam.betPosition, (int)(callBackParam.betGold / 200000));
                }


                PlayerCache.WealthUpdate();
            }
        }
Exemple #26
0
 //GO按钮点击事件
 private void GoOnClick()
 {
     AudioManager.Instance.PlaySound("button");
     //判断是否停止
     if (isStop)
     {
         //向服务器发送开始旋转请求
         SignInDto signInDto = siginOperation.dial(PlayerCache.loginInfo.uid);
         if (signInDto != null)
         {
             BackData(signInDto.indexTemp);
             PlayerCache.SetWealthUpdate(signInDto.items, false);
             PlayerCache.loginInfo.isSignInDialAward = true;
         }
     }
 }
Exemple #27
0
        private IEnumerable <PlayerHistoryItem> GetHistory(PlayerCache playerCache, TimeSpan scoreReportDelay)
        {
            // Get player history
            var history = playerCache.CopyHistory();

            for (int i = history.Count() - 1; i > -1; i--)
            {
                var historyItem = history[i];
                var since       = DateTime.Now.Subtract(historyItem.Time);
                if (since > scoreReportDelay)
                {
                    yield break;
                }
                yield return(historyItem);
            }
        }
Exemple #28
0
        private void PrintTooHighKD(PlayerCache playerCache)
        {
            // Did player kill someone?
            if (playerCache.LastPlayerDelta.Score.Kills < 1)
            {
                return;
            }

            if (playerCache.Player.Score.KillDeathRatio >= _warnCheatAtKDRatio)
            {
                _rconClient.SendMessageAll("Warning: " + playerCache.Player.Name + " has very high kill-death ratio: " +
                                           playerCache.Player.Score.KillDeathRatio + "(" + playerCache.Player.Score.Kills + " kills / " + playerCache.Player.Score.Deaths + " deaths)");
                _rconClient.SendMessageAll("Warning: If " + playerCache.Player.Name +
                                           " is cheating consider a VIP kick vote. Type: /kick " + playerCache.Player.Name);
            }
        }
Exemple #29
0
        private void PlayerEventsOnPlayerUpdated(object sender, PlayerCache playercache)
        {
            var name = playercache.Player.Name;

            if (playercache.LastPlayerDelta.Score.Kills > 0)
            {
                SendToTrackers(playercache.Player, string.Format("KD: {0} kills +{1}. Total: {2}", name, playercache.LastPlayerDelta.Score.Kills, playercache.Player.Score.Kills));
            }
            if (playercache.LastPlayerDelta.Score.Deaths > 0)
            {
                SendToTrackers(playercache.Player, string.Format("KD: {0} deaths +{1}. Total: {2}", name, playercache.LastPlayerDelta.Score.Deaths, playercache.Player.Score.Deaths));
            }
            if (playercache.LastPlayerDelta.Score.Suicides > 0)
            {
                SendToTrackers(playercache.Player, string.Format("KD: {0} suicides +{1}. Total: {2}", name, playercache.LastPlayerDelta.Score.Suicides, playercache.Player.Score.Suicides));
            }
        }
    protected override IEnumerator Execute()
    {
        SetState(NodeState.RUNNING);

        if (PlayerCache.GetEnemyFlagCarrier(agent) == null)
        {
            SetState(NodeState.FAILURE);
            yield break;
        }

        enemyFlagCarrier = PlayerCache.GetEnemyFlagCarrier(agent);

        bbData.ModifyData("EnemyFlagCarrier", enemyFlagCarrier);

        SetState(NodeState.SUCCESS);

        yield return(null);
    }