Exemplo n.º 1
0
        public void HitBallEnd(object sender, GameEventArgs e)
        {
            //HitBallEndEventArgs ne = (HitBallEndEventArgs)e;

            GameEntry.HitBall.ShowFlightPath(GameEntry.GameData.pathBtnState);

            if (GameEntry.GameData.onLine)
            {
                golfballHitData currData = GameEntry.GameData.currGolfball[GameEntry.GameData.currGolfball.Count - 1];
                if (currData.rewardMapId != 0)
                {
                    DRRewardMap data = GameEntry.GameData.webRewardMap[currData.rewardMapId];
                    AddGoods(data.goodsId);
                }
            }

            //得分相关处理
            //ScoreFly();
            ScoreShine();
            Ballshine();
            if (GameEntry.GameData.currGolfball.Count >= GameEntry.GameData.MaxGolfballCount && GameEntry.GameData.onLine)
            {
                StartCoroutine(showResultForm());
            }
            else if ((GameEntry.HitBall.redisland.Count == 8 || GameEntry.HitBall.blueisland.Count == 8) && !GameEntry.GameData.onLine)
            {
                StartCoroutine(showResultForm());
            }
        }
Exemplo n.º 2
0
        public void MsgAnalysis(JsonData res, Action <object> action)
        {
            m2c_getgolfislands m2c = new m2c_getgolfislands();

            m2c.resultCode = res["respVo"]["resultCode"].ToString();
            m2c.resultDesc = res["respVo"]["resultDesc"].ToString();

            if (m2c.resultCode == "0")
            {
                Dictionary <int, DRRewardMap> RewardMap = new Dictionary <int, DRRewardMap>();
                List <Vector2> webPos = new List <Vector2>();
                for (int i = 0; i < res["golfislandsmap"].Count; i++)
                {
                    Vector2 vec2 = new Vector2();
                    vec2.x = float.Parse(res["golfislandsmap"][i]["topx"].ToString());
                    vec2.y = float.Parse(res["golfislandsmap"][i]["topy"].ToString());
                    webPos.Add(vec2);

                    JsonData rolepro = res["golfislandsmap"][i]["golfislandawardsmap"]["golfislandawardsmap"];
                    for (int j = 0; j < rolepro.Count; j++)
                    {
                        DRRewardMap map = new DRRewardMap();
                        map.Id         = int.Parse(rolepro[j]["ptseq"].ToString());
                        map.Score      = int.Parse(rolepro[j]["gpoint"].ToString());
                        map.ScoreColor = rolepro[j]["gpcolor"].ToString();
                        if (((IDictionary)rolepro[j]).Contains("url"))
                        {
                            map.ImageUrl = rolepro[j]["url"].ToString();
                        }
                        map.goodsId = int.Parse(rolepro[j]["sid"].ToString());

                        RewardMap.Add(map.Id, map);
                    }
                }
                GameEntry.GameData.webPos = webPos;
                m2c.webRewardMap          = RewardMap;
            }

            if (action != null)
            {
                action(m2c);
            }
        }
        /// <summary>
        /// 处理ballHitData
        /// </summary>
        public void SetScoreData(int rewardMapId, out int score)
        {
            if (dtRewardMap == null)
            {
                RefreshRewardMap();
            }

            DRRewardMap rewardMapData = new DRRewardMap();

            if (rewardMapId != 0)
            {
                if (onLine)
                {
                    rewardMapData = webRewardMap[rewardMapId];
                }
                else
                {
                    rewardMapData = dtRewardMap.GetDataRow(rewardMapId);
                }
            }
            score = rewardMapData.Score;
        }