123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227 |
- using Newtonsoft.Json.Linq;
- using CSharpUtil;
- using System;
- using System.Linq;
- using System.Collections.Generic;
- using UnityEngine;
- public class CollegeProxy :ProxyBase<CollegeProxy>
- {
- public CollegeProxy() => this.opeCode = OpeCode.ope_college;
- /// <summary>
- /// 获取学院信息--old
- /// </summary>
- /// <returns></returns>
- //public CollegeVo GetCollegeInfo()
- //{
- // CollegeVo vo = new CollegeVo();
- // return vo;
- //}
- /// <summary>
- /// [7301] 激活
- /// </summary>
- /// <param name="taskCardId"></param>
- /// <param name="callback"></param>
- /// <param name="faild"></param>
- public void ActiveTaskCard(int taskCardId, Action<CollegeVo> callback, Action faild)
- {
- Post(CmdCode.cmd_college_ActiveTaskCard, new object[] { taskCardId },
- resp =>
- {
- var p = UserProxy.Instance.player;
- //p.InitFromStore((JObject)resp.result["store"]);
- p.collegeInfo.Initlize(resp.result["college"]);
- CollegeVo vo = new CollegeVo(taskCardId);
- if (callback != null)
- {
- callback.Invoke(vo);
- }
- });
- }
- /// <summary>
- /// [7302] 领取年级奖励
- /// </summary>
- /// <param name="callback"></param>
- /// <param name="faild"></param>
- //public void ReceiveCollegeReward(Action<CollegeVo> callback, Action faild)
- //{
- // Post(CmdCode.cmd_college_ReceiveCollegeReward, new object[] { },
- // resp =>
- // {
- // var p = UserProxy.Instance.player;
- // //p.InitFromStore((JObject)resp.result["store"]); // 更新任务卡
- // p.collegeInfo.Initlize(resp.result["college"]);
- // p.baseInfo.gold = Convert.ToInt32(resp.result["gold"].ToString());
- // p.baseInfo.cash = Convert.ToInt32(resp.result["cash"].ToString());
- // p.baseInfo.level = Convert.ToInt32(resp.result["lvl"].ToString());
- // CollegeVo vo = new CollegeVo();
- // if (callback != null)
- // {
- // callback.Invoke(vo);
- // }
- // });
- //}
- /// <summary>
- /// [7303] 领取课程奖励
- /// </summary>
- /// <param name="callback"></param>
- /// <param name="faild"></param>
- //public void ReceiveCourseReward(Action<CollegeVo> callback, Action faild)
- //{
- // Post(CmdCode.cmd_college_ReceiveCourseReward, new object[] { },
- // resp =>
- // {
- // var p = UserProxy.Instance.player;
- // //p.InitFromStore((JObject)resp.result["store"]); // 更新任务卡
- // p.collegeInfo.Initlize(resp.result["college"]);
- // p.baseInfo.gold = Convert.ToInt32(resp.result["gold"].ToString());
- // p.baseInfo.cash = Convert.ToInt32(resp.result["cash"].ToString());
- // p.baseInfo.level = Convert.ToInt32(resp.result["lvl"].ToString());
- // CollegeVo vo = new CollegeVo();
- // if (callback != null)
- // {
- // callback.Invoke(vo);
- // }
- // });
- //}
- //----------------------------new
- /// <summary>
- /// 新的
- /// </summary>
- /// <returns></returns>
- public void GetCollegeInfo(int type,Action<CollegeVo> callback)
- {
- Post(CmdCode.cmd_college_GetCollegeData, new object[] { },
- resp =>
- {
- var p = UserProxy.Instance.player;
- p.InitFromStore((JObject)resp.result["store"]); // 更新任务卡
- p.collegeInfo.Initlize(resp.result["college"]);
-
- if (callback != null)
- {
- callback.Invoke(new CollegeVo (type));
- }
- });
- //
- //List<CollegeNewVo> collegelist = new List<CollegeNewVo>();
- //CollegeNewVo collegeVo = null;
- //foreach (KeyValuePair<int, Dictionary<int, Dictionary<string, missCourseItem>>> kv in ingTaskCardDic)
- //{
- // if (kv.Key == type)
- // {
- // collegeVo = new CollegeNewVo(kv.Key);
- // //Dictionary<int, Dictionary<string, missCourseItem>> courseDic = kv.Value;
- // //List<CourseNewVo> clist = new List<CourseNewVo>();
- // //foreach (KeyValuePair<int, Dictionary<string, missCourseItem>> kt in courseDic)
- // //{
- // // CourseNewVo courseVo = new CourseNewVo(kv.Key, kt.Key);
- // // Dictionary<string, missCourseItem> cardDic = kt.Value;
- // // List<TaskCardDataNewVo> taskCardList = new List<TaskCardDataNewVo>();
- // // foreach (KeyValuePair<string, missCourseItem> kn in cardDic)
- // // {
- // // TaskCardDataNewVo cardVo = new TaskCardDataNewVo(kv.Key, kt.Key, kn.Key);
- // // taskCardList.Add(cardVo);
- // // }
- // // courseVo.taskCardList = taskCardList;
- // // clist.Add(courseVo);
- // //}
- // //collegeVo.courseList = clist;
- // break;
- // }
- //}
- //return collegeVo;
- }
- /// <summary>
- /// [7302] 领取年级奖励
- /// </summary>
- /// <param name="callback"></param>
- /// <param name="faild"></param>
- public void ReceiveCollegeReward(int collegeId,Action<CollegeVo> callback, Action faild)
- {
- Post(CmdCode.cmd_college_ReceiveCollegeReward, new object[] { collegeId },
- resp =>
- {
- var p = UserProxy.Instance.player;
- p.InitFromStore((JObject)resp.result["store"]); // 更新任务卡
- p.collegeInfo.Initlize(resp.result["college"]);
- p.baseInfo.gold = Convert.ToInt32(resp.result["gold"].ToString());
- p.baseInfo.cash = Convert.ToInt32(resp.result["cash"].ToString());
- p.baseInfo.level = Convert.ToInt32(resp.result["lvl"].ToString());
- CollegeVo vo = new CollegeVo(collegeId);
- if (callback != null)
- {
- callback.Invoke(vo);
- }
- });
- }
- /// <summary>
- /// [7303] 领取课程奖励
- /// </summary>
- /// <param name="callback"></param>
- /// <param name="faild"></param>
- public void ReceiveCourseReward(int collegeId,int courseId,Action<CollegeVo> callback, Action faild)
- {
- Post(CmdCode.cmd_college_ReceiveCourseReward, new object[] { collegeId,courseId },
- resp =>
- {
- var p = UserProxy.Instance.player;
- p.InitFromStore((JObject)resp.result["store"]); // 更新任务卡
- p.collegeInfo.Initlize(resp.result["college"]);
- p.baseInfo.gold = Convert.ToInt32(resp.result["gold"].ToString());
- p.baseInfo.cash = Convert.ToInt32(resp.result["cash"].ToString());
- p.baseInfo.level = Convert.ToInt32(resp.result["lvl"].ToString());
- CollegeVo vo = new CollegeVo(collegeId);
- if (callback != null)
- {
- callback.Invoke(vo);
- }
- });
- }
- /// <summary>
- /// 积分兑换
- /// </summary>
- /// <param name="id"></param>
- /// <param name="callback"></param>
- /// <param name="faild"></param>
- public void ScoreExchangeItem(int id, Action<List<CollegeScoreVo>> callback, Action faild)
- {
- Post(CmdCode.cmd_college_ScoreExchangeItem, new object[] { id },
- resp =>
- {
- var p = UserProxy.Instance.player;
- p.InitFromStore((JObject)resp.result["store"]); // 更新任务卡
- p.collegeInfo.Initlize(resp.result["college"]);
- Dictionary<Int32, sm_score> score = GameConfigData.Ins.score;
- List<CollegeScoreVo> list = new List<CollegeScoreVo>();
- foreach (KeyValuePair<int,sm_score>kv in score)
- {
- CollegeScoreVo vo = new CollegeScoreVo(kv.Key);
- list.Add(vo);
- }
-
- if (callback != null)
- {
- callback.Invoke(list);
- }
- });
- }
- }
|