IEnumerator OnUseJson() { string url = PathUtil.DataUrl + "test_WarEnterData.json"; WWW www = new WWW(url); yield return(www); if (string.IsNullOrEmpty(www.error)) { Debug.Log(url); WarEnterData enterData = JsonConvert.DeserializeObject(www.text, typeof(WarEnterData)) as WarEnterData; War.Start(enterData); } else { Debug.Log(string.Format("<color=red>[WarEnterData] test_WarEnterData.json失败 url={0} error={1} text={2}</color>", url, www.error, www.text)); } www.Dispose(); www = null; // StartCoroutine(CloseSound()); }
static int Init(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 1); Games.Module.Wars.WarEnterData obj = (Games.Module.Wars.WarEnterData)LuaScriptMgr.GetNetObjectSelf(L, 1, "Games.Module.Wars.WarEnterData"); obj.Init(); return(0); }
static int Start(IntPtr L) { int count = LuaDLL.lua_gettop(L); if (count == 1) { Games.Module.Wars.WarEnterData arg0 = (Games.Module.Wars.WarEnterData)LuaScriptMgr.GetNetObject(L, 1, typeof(Games.Module.Wars.WarEnterData)); Games.Module.Wars.War.Start(arg0); return(0); } else if (count == 2) { CC.Runtime.PB.ProtoBattleVideoInfo arg0 = (CC.Runtime.PB.ProtoBattleVideoInfo)LuaScriptMgr.GetNetObject(L, 1, typeof(CC.Runtime.PB.ProtoBattleVideoInfo)); int arg1 = (int)LuaScriptMgr.GetNumber(L, 2); Games.Module.Wars.War.Start(arg0, arg1); return(0); } else if (count == 3) { LuaStringBuffer arg0 = LuaScriptMgr.GetStringBuffer(L, 1); int arg1 = (int)LuaScriptMgr.GetNumber(L, 2); bool arg2 = LuaScriptMgr.GetBoolean(L, 3); Games.Module.Wars.War.Start(arg0, arg1, arg2); return(0); } else { LuaDLL.luaL_error(L, "invalid arguments to method: Games.Module.Wars.War.Start"); } return(0); }
static int CheckWatchRole(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 2); Games.Module.Wars.WarEnterData obj = (Games.Module.Wars.WarEnterData)LuaScriptMgr.GetNetObjectSelf(L, 1, "Games.Module.Wars.WarEnterData"); int arg0 = (int)LuaScriptMgr.GetNumber(L, 2); obj.CheckWatchRole(arg0); return(0); }
static int FindMinLegionId(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 1); Games.Module.Wars.WarEnterData obj = (Games.Module.Wars.WarEnterData)LuaScriptMgr.GetNetObjectSelf(L, 1, "Games.Module.Wars.WarEnterData"); int o = obj.FindMinLegionId(); LuaScriptMgr.Push(L, o); return(1); }
static int ToString(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 1); Games.Module.Wars.WarEnterData obj = (Games.Module.Wars.WarEnterData)LuaScriptMgr.GetNetObjectSelf(L, 1, "Games.Module.Wars.WarEnterData"); string o = obj.ToString(); LuaScriptMgr.Push(L, o); return(1); }
static int GetSoliderProps(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 2); Games.Module.Wars.WarEnterData obj = (Games.Module.Wars.WarEnterData)LuaScriptMgr.GetNetObjectSelf(L, 1, "Games.Module.Wars.WarEnterData"); int arg0 = (int)LuaScriptMgr.GetNumber(L, 2); Games.Module.Props.Prop[] o = obj.GetSoliderProps(arg0); LuaScriptMgr.PushArray(L, o); return(1); }
static int GetRoleId(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 2); Games.Module.Wars.WarEnterData obj = (Games.Module.Wars.WarEnterData)LuaScriptMgr.GetNetObjectSelf(L, 1, "Games.Module.Wars.WarEnterData"); int arg0 = (int)LuaScriptMgr.GetNumber(L, 2); int o = obj.GetRoleId(arg0); LuaScriptMgr.Push(L, o); return(1); }
static int GetHeroInitHP(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 3); Games.Module.Wars.WarEnterData obj = (Games.Module.Wars.WarEnterData)LuaScriptMgr.GetNetObjectSelf(L, 1, "Games.Module.Wars.WarEnterData"); int arg0 = (int)LuaScriptMgr.GetNumber(L, 2); int arg1 = (int)LuaScriptMgr.GetNumber(L, 3); float o = obj.GetHeroInitHP(arg0, arg1); LuaScriptMgr.Push(L, o); return(1); }
/** heroSkill=[buildIndx, heroId, skillId, skillLevel, skillId2, skillLevel2] */ public static WarEnterData CreateTest(int stageId, int ownLegionId, int[][] heroSkills, int[][] completeHeroSkills) { int ownRoleId = 1; WarEnterData enterData = new WarEnterData(); enterData.stageId = stageId; enterData.ownRoleId = ownRoleId; enterData.ownLegionId = ownLegionId; enterData.mainLegionId = ownLegionId; WarEnterLegionData legionData = new WarEnterLegionData(); legionData.legionId = ownLegionId; legionData.name = "赵信他爷"; legionData.maxAtk = 100; legionData.maxMovespeed = 100; legionData.maxProduceSpeed = 100; legionData.totalAtk = 64.925f; legionData.totalMoveSpeed = 2f; // legionData.totalMoveSpeed = 1f; legionData.totalProduceSpeed = 0.34f; legionData.initHP = 20; legionData.solider = new WarEnterSoliderData(); legionData.solider.level = 1; legionData.solider.props = new Prop[] { Prop.CreateInstance(PropId.AtkAdd, 362), Prop.CreateInstance(PropId.DefAdd, 221), Prop.CreateInstance(PropId.MaxHpAdd, 1), Prop.CreateInstance(PropId.MoveSpeedAdd, 3f), Prop.CreateInstance(PropId.KillHeroAdd, 50) }; foreach (int[] heroSkill in heroSkills) { WarEnterHeroData heroData = new WarEnterHeroData(); heroData.heroId = heroSkill[0]; heroData.skillId = heroSkill[1]; heroData.level = heroSkill[2]; heroData.props = new Prop[] { Prop.CreateInstance(PropId.AtkAdd, 10), Prop.CreateInstance(PropId.DefAdd, 20), Prop.CreateInstance(PropId.ProduceSpeedAdd, 0.065f), Prop.CreateInstance(PropId.MaxHpAdd, 3.32f), Prop.CreateInstance(PropId.DefKillHeroAdd, 90) }; legionData.heroList.Add(heroData); } enterData.legionList.Add(legionData); CreateTestCompleteLegion(enterData, completeHeroSkills); return(enterData); }
static int CreateTest(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 4); int arg0 = (int)LuaScriptMgr.GetNumber(L, 1); int arg1 = (int)LuaScriptMgr.GetNumber(L, 2); int[][] objs2 = LuaScriptMgr.GetArrayObject <int[]>(L, 3); int[][] objs3 = LuaScriptMgr.GetArrayObject <int[]>(L, 4); Games.Module.Wars.WarEnterData o = Games.Module.Wars.WarEnterData.CreateTest(arg0, arg1, objs2, objs3); LuaScriptMgr.PushObject(L, o); return(1); }
static int _CreateGames_Module_Wars_WarEnterData(IntPtr L) { int count = LuaDLL.lua_gettop(L); if (count == 0) { Games.Module.Wars.WarEnterData obj = new Games.Module.Wars.WarEnterData(); LuaScriptMgr.PushObject(L, obj); return(1); } else { LuaDLL.luaL_error(L, "invalid arguments to method: Games.Module.Wars.WarEnterData.New"); } return(0); }
static void CreateTestCompleteLegion(WarEnterData enterData, int[][] heroSkills) { WarEnterLegionData legionData = new WarEnterLegionData(); legionData.legionId = 2; legionData.name = "Computer"; legionData.maxAtk = 100; legionData.maxMovespeed = 100; legionData.maxProduceSpeed = 100; legionData.totalAtk = 20; legionData.totalMoveSpeed = 3; legionData.totalProduceSpeed = 4; legionData.initHP = 20; legionData.solider = new WarEnterSoliderData(); legionData.solider.level = 1; legionData.solider.props = new Prop[] { Prop.CreateInstance(PropId.AtkAdd, 362), Prop.CreateInstance(PropId.DefAdd, 221), Prop.CreateInstance(PropId.MaxHpAdd, 1), Prop.CreateInstance(PropId.MoveSpeedAdd, 3f), Prop.CreateInstance(PropId.KillHeroAdd, 50) }; foreach (int[] heroSkill in heroSkills) { WarEnterHeroData heroData = new WarEnterHeroData(); heroData.heroId = heroSkill[0]; heroData.skillId = heroSkill[1]; heroData.level = heroSkill[2]; heroData.props = new Prop[] { Prop.CreateInstance(PropId.AtkAdd, 140), Prop.CreateInstance(PropId.DefAdd, 20), Prop.CreateInstance(PropId.ProduceSpeedAdd, 0.065f), Prop.CreateInstance(PropId.MaxHpAdd, 3.32f), Prop.CreateInstance(PropId.DefKillHeroAdd, 90) }; legionData.heroList.Add(heroData); } enterData.legionList.Add(legionData); }
static int set_rivalRoleId(IntPtr L) { object o = LuaScriptMgr.GetLuaObject(L, 1); Games.Module.Wars.WarEnterData obj = (Games.Module.Wars.WarEnterData)o; if (obj == null) { LuaTypes types = LuaDLL.lua_type(L, 1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name rivalRoleId"); } else { LuaDLL.luaL_error(L, "attempt to index rivalRoleId on a nil value"); } } obj.rivalRoleId = (int)LuaScriptMgr.GetNumber(L, 3); return(0); }
static int get_overMenuId(IntPtr L) { object o = LuaScriptMgr.GetLuaObject(L, 1); Games.Module.Wars.WarEnterData obj = (Games.Module.Wars.WarEnterData)o; if (obj == null) { LuaTypes types = LuaDLL.lua_type(L, 1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name overMenuId"); } else { LuaDLL.luaL_error(L, "attempt to index overMenuId on a nil value"); } } LuaScriptMgr.Push(L, obj.overMenuId); return(1); }
static int set_isRecord(IntPtr L) { object o = LuaScriptMgr.GetLuaObject(L, 1); Games.Module.Wars.WarEnterData obj = (Games.Module.Wars.WarEnterData)o; if (obj == null) { LuaTypes types = LuaDLL.lua_type(L, 1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name isRecord"); } else { LuaDLL.luaL_error(L, "attempt to index isRecord on a nil value"); } } obj.isRecord = LuaScriptMgr.GetBoolean(L, 3); return(0); }
static int set_vsmode(IntPtr L) { object o = LuaScriptMgr.GetLuaObject(L, 1); Games.Module.Wars.WarEnterData obj = (Games.Module.Wars.WarEnterData)o; if (obj == null) { LuaTypes types = LuaDLL.lua_type(L, 1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name vsmode"); } else { LuaDLL.luaL_error(L, "attempt to index vsmode on a nil value"); } } obj.vsmode = (Games.Module.Wars.VSMode)LuaScriptMgr.GetNetObject(L, 3, typeof(Games.Module.Wars.VSMode)); return(0); }
static int set_legionList(IntPtr L) { object o = LuaScriptMgr.GetLuaObject(L, 1); Games.Module.Wars.WarEnterData obj = (Games.Module.Wars.WarEnterData)o; if (obj == null) { LuaTypes types = LuaDLL.lua_type(L, 1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name legionList"); } else { LuaDLL.luaL_error(L, "attempt to index legionList on a nil value"); } } obj.legionList = (List <Games.Module.Wars.WarEnterLegionData>)LuaScriptMgr.GetNetObject(L, 3, typeof(List <Games.Module.Wars.WarEnterLegionData>)); return(0); }
public void Generation(WarEnterData enterData) { enterData.Init(); this.enterData = enterData; this.ownLegionID = enterData.ownLegionId; #if UNITY_EDITOR Debug.Log("War.isEditor=" + War.isEditor); if (War.isEditor) { this.stageConfig = War.model.Editor_GetStage(enterData.stageId); if (this.stageConfig == null) { this.stageConfig = War.model.GetStage(enterData.stageId).Clone(); War.model.Editor_stageConfigs.Add(this.stageConfig.id, this.stageConfig); } } else { this.stageConfig = War.model.GetStage(enterData.stageId); } #else this.stageConfig = War.model.GetStage(enterData.stageId); #endif Debug.Log("stageConfig=" + stageConfig); Debug.Log("stageConfig.resource=" + stageConfig.resource); Debug.Log("stageConfig.mapConfig=" + stageConfig.mapConfig); Debug.Log("enterData.ownLegionId=" + enterData.ownLegionId); this.mapConfig = stageConfig.mapConfig; War.ownLegionID = enterData.ownLegionId; War.mainLegionID = enterData.mainLegionId = enterData.FindMinLegionId(); War.service.roomId = enterData.roomId; War.service.roleId = enterData.ownRoleId; War.service.ownLegionId = enterData.ownLegionId; this.id = stageConfig.id; this.showHP = stageConfig.showHP; if (War.model.HasWeightConfig(this.id)) { this.weight = War.model.GetWeightConfig(this.id); } War.timeMax = stageConfig.time; begionDelayTime = War.vsmode == VSMode.PVP ? 2 : 0; if (War.isEditor) { War.timeMax = 0; } // War.timeMax = 20; War.timeLimit = War.timeMax > 0f; // if(War.isTest) showHP = false; GenerationLegions(); GenerationSoliders(); GenerationHeros(); GenerationBuilds(); GenerationWalls(); foreach (KeyValuePair <int, LegionData> kvp in legionDict) { kvp.Value.Init(); } InitAttachPropData(); InitUseSkillBuildId(); }
/// <summary> /// 进入战斗 /// </summary> /// <param name="enterData">进入战斗数据</param> public static void Start(WarEnterData enterData) { Debug.Log("进入战斗数据 enterData=" + enterData); if (War.isTest) { War.Clear(); } War.enterData = enterData; War.isRecord = enterData.isRecord; // 初始化 War.Init(); // 战斗流程状态--生成数据 War.processState = WarProcessState.GenerateData; // 对战模式 War.vsmode = enterData.vsmode; // 是否自动关闭加载面板 War.isAutoCloseLoad = !War.requireSynch; // 自己势力ID War.ownLegionID = enterData.ownLegionId; Debug.LogFormat("type====={0}", enterData.vsmode); // 战斗已过时间 War.time = 0; // 战斗环境配置--PC机是否开启PC操作模式 War.config.PCOperater = ConstConfig.GetInt(ConstConfig.ID.War_PCOperater) == 1; // 生成战场数据 War.sceneData = new SceneDataForEnterData(); (War.sceneData as SceneDataForEnterData).Generation(enterData); // 生成预加载资源 WarRes.GenerationPreloadList(); // 战斗流程状态--加载中 War.processState = WarProcessState.Loading; if (War.isEditor == false) { if (!War.isTest) { LoadType loadType = LoadType.None; switch (War.vsmode) { case VSMode.Dungeon: case VSMode.Train: loadType = LoadType.Scene_Dungeon; break; case VSMode.PVP: loadType = LoadType.Scene_PVP; break; case VSMode.PVE: case VSMode.PVE_Expedition: default: loadType = LoadType.Scene_Normal; break; } Coo.menuManager.OpenMenuBack(MenuType.WarScene, enterData.backMenuId, null, loadType); } } War.signal.GenerateDataComplete(); Debug.Log(" 战斗数据生成完毕 War.sGenerateDataComplete.Dispatch();"); LuaCallMethod("Start"); }
void Test_StartGame() { int stageId = 1091; VSMode vsModel = VSMode.Dungeon; TestWarParameter parameter = GameObject.Find("GlobalGenerator").GetComponent <TestWarParameter>(); if (parameter != null) { stageId = parameter.stageId; vsModel = parameter.vsMode; if (parameter.useJsonData) { StartCoroutine(OnUseJson()); return; } else if (parameter.useRecrodJson) { StartCoroutine(WRTimeLineData.OnUseJson(parameter.watchRoleId)); return; } else if (parameter.useRecrodBinary) { StartCoroutine(WRTimeLineData.OnUseBinary(parameter.watchRoleId)); return; } } // heroSkill=[heroId, skillId, skillLevel, skillId2, skillLevel2] // WarEnterData enterData = WarEnterData.CreateTest(3004, 1, new int[][]{ // new int[]{2, 20002, 1, 1, 101, 1}, // new int[]{5, 20003, 2, 1, 102, 1} // }); WarEnterData enterData; enterData = WarEnterData.CreateTest(stageId, 1, // 自己技能 new int[][] { // new int[]{20003, 8, 1, 0, 1}, // new int[]{20004, 8, 1, 0, 1}, // new int[]{20010, 8, 1, 0, 0}, // new int[]{20102, 8, 1, 0, 0}, // new int[]{20107, 8, 1, 0, 0}, // new int[]{20109, 8, 1, 0, 0}, // new int[]{20202, 17, 1, 0, 0}, // new int[]{20204, 19, 1, 0, 0}, // new int[]{20104, 8, 1, 0, 0}, // new int[]{20205, 8, 1, 0, 0}, // new int[]{20104, 3, 1, 0, 0}, // new int[]{20206, 3, 1, 0, 0}, // new int[]{20205, 12, 1, 0, 0}, new int[] { 20301, 19, 1, 0, 0 }, new int[] { 20302, 24, 1, 0, 0 }, new int[] { 20303, 25, 1, 0, 0 }, new int[] { 20304, 32, 1, 0, 0 }, new int[] { 20305, 33, 1, 0, 0 }, // new int[]{20301, 8, 1, 0, 0}, // new int[]{20302, 32, 1, 0, 0}, // new int[]{20303, 32, 1, 0, 0}, // new int[]{20304, 3, 1, 0, 0}, // new int[]{20305, 32, 1, 0, 0}, //new int[]{20202, 100004, 1, 0, 0}, //new int[]{20204, 100005, 1, 0, 0}, //new int[]{20205, 100006, 1, 0, 0}, //new int[]{20301, 100007, 1, 0, 0}, //new int[]{20302, 100008, 1, 0, 0}, }, //电脑技能 new int[][] { // new int[]{20301, 251001, 1, 0, 0}, // new int[]{20302, 251001, 1, 0, 0}, // new int[]{20303, 251001, 1, 0, 0}, new int[] { 20301, 101001, 1, 0, 0 }, new int[] { 20302, 191001, 1, 0, 0 }, new int[] { 20303, 251001, 1, 0, 0 }, new int[] { 20304, 311001, 1, 0, 0 }, } ); enterData.skillConfigDict = skillConfigs; enterData.vsmode = vsModel; War.Start(enterData); // StartCoroutine(CloseSound()); }