Example #1
0
        public ChickenRankData ApplyChickenRank(ulong charId)
        {
            if (ChickenManager.mDbData == null)
            {
                ChickenManager.mDbData = new List <DBChickenData>();
            }
            ChickenRankData result = new ChickenRankData();

            for (int i = 0; i < ChickenManager.mDbData.Count; i++)
            {
                var db = new ChickenData();
                db.Score      = ChickenManager.mDbData[i].Score;
                db.FightValue = ChickenManager.mDbData[i].FightValue;
                db.Guid       = ChickenManager.mDbData[i].Guid;
                db.Level      = ChickenManager.mDbData[i].Level;
                db.Name       = ChickenManager.mDbData[i].Name;
                db.Profession = ChickenManager.mDbData[i].Profession;
                db.Rank       = ChickenManager.mDbData[i].Rank;
                result.RankList.Add(db);
            }
            var idx = ChickenManager.mDbData.FindIndex(o => { return(o.Guid == charId); });

            if (idx != -1)
            {
                result.MyRank            = new ChickenData();
                result.MyRank.Score      = ChickenManager.mDbData[idx].Score;
                result.MyRank.FightValue = ChickenManager.mDbData[idx].FightValue;
                result.MyRank.Guid       = ChickenManager.mDbData[idx].Guid;
                result.MyRank.Level      = ChickenManager.mDbData[idx].Level;
                result.MyRank.Name       = ChickenManager.mDbData[idx].Name;
                result.MyRank.Profession = ChickenManager.mDbData[idx].Profession;
                result.MyRank.Rank       = ChickenManager.mDbData[idx].Rank;
            }
            return(result);
        }
        private void InitializeVisualData(GamePresentation presentation)
        {
            ClearData();

            foreach (var chicken in presentation.Chickens)
            {
                var material        = chicken.Team == GameTeam.Light ? LightTeamUnitMaterial : DarkTeamUnitMaterial;
                var currentPosition = chicken.GetCurrentPosition();

                var matrix    = GetChickenTransformMatrix(chicken);
                var transform = new MatrixTransform3D(matrix);
                var position  = ConvertEnginePosition(currentPosition.Position);

                var chickenVisual = new ModelVisual3D
                {
                    Content = new GeometryModel3D(_chickenGeometry, material)
                    {
                        Transform = transform
                    }
                };

                var billboardVisual = new BillboardTextVisual3D
                {
                    Text       = "(ID)",
                    FontWeight = FontWeights.ExtraBold,
                    FontSize   = 9,
                    Foreground = new SolidColorBrush(
                        chicken.Team == GameTeam.Light ? LightTeamCaptionColor : DarkTeamCaptionColor),
                    Background      = new SolidColorBrush(Colors.Gray.WithAlpha(128)),
                    BorderBrush     = new SolidColorBrush(Colors.Red.WithAlpha(128)),
                    BorderThickness = new Thickness(1)
                };

                var data = new ChickenData(
                    chicken.UniqueId,
                    position,
                    currentPosition.Angle.DegreeValue,
                    chickenVisual,
                    transform,
                    billboardVisual);

                _chickenDatas.Add(data.Id, data);
                _chickenVisualToData.Add(chickenVisual, data);
                this.BoardVisual.Children.Add(chickenVisual);
                this.BoardVisual.Children.Add(billboardVisual);
            }
        }
Example #3
0
        private IEnumerator SendSyncBatteryGuidMsg(Coroutine co)
        {
            ChickenRankData data = new ChickenRankData();

            for (int i = 0; i < _playerList.Count; i++)
            {
                ChickenData dataItem = new ChickenData();
                var         player   = FindPlayer(_playerList[i].objId);
                dataItem.Score      = _playerList[i].point;
                dataItem.FightValue = player.Attr.GetFightPoint();
                dataItem.Guid       = _playerList[i].objId;
                dataItem.Level      = player.GetLevel();
                dataItem.Name       = _playerList[i].name;
                dataItem.Profession = player.TypeId;
                dataItem.Rank       = i + 1;
                data.RankList.Add(dataItem);
            }
            var notifyMsg = SceneServer.Instance.ActivityAgent.SSSyncChickenScore(0, data);

            yield return(notifyMsg.SendAndWaitUntilDone(co));
        }