1
This commit is contained in:
parent
3c8df7a0f0
commit
d94a18c827
@ -84,7 +84,7 @@ namespace F6
|
|||||||
if (this.handlerHash.TryGetValue(msgId, out handler))
|
if (this.handlerHash.TryGetValue(msgId, out handler))
|
||||||
{
|
{
|
||||||
var msg = handler.createMsg();
|
var msg = handler.createMsg();
|
||||||
msg.Descriptor.Parser.ParseFrom(data, offset, length);
|
msg = msg.Descriptor.Parser.ParseFrom(data, offset, length);
|
||||||
foreach (var h in handler.handlers)
|
foreach (var h in handler.handlers)
|
||||||
{
|
{
|
||||||
h(msg);
|
h(msg);
|
||||||
|
@ -5,11 +5,16 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Google.Protobuf;
|
using Google.Protobuf;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using LuaFramework;
|
||||||
|
|
||||||
class Battle
|
class Battle
|
||||||
{
|
{
|
||||||
private JoinInfo joinInfo;
|
private JoinInfo joinInfo;
|
||||||
private Net.ClientNet conn;
|
private Net.ClientNet conn;
|
||||||
|
private int netMapId = 0;
|
||||||
|
private int netMyselfUniId = 0;
|
||||||
|
private string netRoomUuid;
|
||||||
|
private Mt.Map mapMeta;
|
||||||
|
|
||||||
public Battle(JoinInfo joinInfo)
|
public Battle(JoinInfo joinInfo)
|
||||||
{
|
{
|
||||||
@ -29,8 +34,55 @@ class Battle
|
|||||||
this.conn.Open();
|
this.conn.Open();
|
||||||
this.conn.msgHandler.RegisterHandler((battle.cs.SMJoinedNotify msg) =>
|
this.conn.msgHandler.RegisterHandler((battle.cs.SMJoinedNotify msg) =>
|
||||||
{
|
{
|
||||||
int i = 0;
|
|
||||||
});
|
});
|
||||||
|
this.conn.msgHandler.RegisterHandler((battle.cs.SMMapInfo msg) =>
|
||||||
|
{
|
||||||
|
this.SMMapInfo(msg);
|
||||||
|
});
|
||||||
|
this.conn.msgHandler.RegisterHandler((battle.cs.SMUpdate msg) =>
|
||||||
|
{
|
||||||
|
this.SMUpdate(msg);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SMMapInfo(battle.cs.SMMapInfo msg)
|
||||||
|
{
|
||||||
|
this.netMapId = msg.MapId;
|
||||||
|
this.netMyselfUniId = msg.PlayerId;
|
||||||
|
this.netRoomUuid = msg.RoomUuid;
|
||||||
|
|
||||||
|
this.mapMeta = Mt.Table.Map.GetById(this.netMapId);
|
||||||
|
GameObject fightRootObject = new GameObject("fight");
|
||||||
|
{
|
||||||
|
fightRootObject.transform.parent = LuaHelper.GetGameManager().m_pGameMap.transform;
|
||||||
|
fightRootObject.layer = CUtil.WorldMapLayer_0_31;
|
||||||
|
}
|
||||||
|
GameObject mapObj = new GameObject("map");
|
||||||
|
{
|
||||||
|
mapObj.transform.parent = fightRootObject.transform;
|
||||||
|
mapObj.layer = CUtil.WorldMapLayer_0_31;
|
||||||
|
TransformExtension.localPosition(mapObj.transform, 0, 0, 0);
|
||||||
|
TransformExtension.localScale(mapObj.transform, 1, 1, 1);
|
||||||
|
}
|
||||||
|
var mapBase = LuaHelper.GetResManager().LoadPrefab<GameObject>(this.mapMeta.asset_name, "Data/model/mapterrain/", "model/mapterrain");
|
||||||
|
var t = CUtil.AddChild(mapObj, mapBase, true);
|
||||||
|
{
|
||||||
|
TransformExtension.localEulerAngles(t.transform, 0, 0, 0);
|
||||||
|
TransformExtension.localPosition(t.transform, 0, 0, 0);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
var terrainName = "l_" + this.mapMeta.asset_name;
|
||||||
|
var terrainObj = LuaHelper.GetResManager().LoadPrefab<GameObject>(
|
||||||
|
terrainName, "Data/model/mapterrain/", "model/mapterrain");
|
||||||
|
CUtil.AddChild(t, terrainObj, true);
|
||||||
|
TransformExtension.localEulerAngles(terrainObj.transform, 0, 0, 0);
|
||||||
|
TransformExtension.localPosition(terrainObj.transform, 0, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SMUpdate(battle.cs.SMUpdate msg)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,35 +14,7 @@ public class BattleMgr
|
|||||||
//CUILoading.OpenLoading();
|
//CUILoading.OpenLoading();
|
||||||
//CUILoading.SetLoading(0);
|
//CUILoading.SetLoading(0);
|
||||||
Mt.Table.Load();
|
Mt.Table.Load();
|
||||||
GameObject fightRootObject = new GameObject("fight");
|
var b = new Battle(join_info);
|
||||||
{
|
|
||||||
fightRootObject.transform.parent = LuaHelper.GetGameManager().m_pGameMap.transform;
|
|
||||||
fightRootObject.layer = CUtil.WorldMapLayer_0_31;
|
|
||||||
}
|
|
||||||
GameObject mapObj = new GameObject("map");
|
|
||||||
{
|
|
||||||
mapObj.transform.parent = fightRootObject.transform;
|
|
||||||
mapObj.layer = CUtil.WorldMapLayer_0_31;
|
|
||||||
TransformExtension.localPosition(mapObj.transform, 0, 0, 0);
|
|
||||||
TransformExtension.localScale(mapObj.transform, 1, 1, 1);
|
|
||||||
}
|
|
||||||
var mapBase = LuaHelper.GetResManager().LoadPrefab<GameObject>("map16", "Data/model/mapterrain/", "model/mapterrain");
|
|
||||||
var t = CUtil.AddChild(mapObj, mapBase, true);
|
|
||||||
{
|
|
||||||
TransformExtension.localEulerAngles(t.transform, 0, 0, 0);
|
|
||||||
TransformExtension.localPosition(t.transform, 0, 0, 0);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
var terrainName = "l_" + "map16";
|
|
||||||
var terrainObj = LuaHelper.GetResManager().LoadPrefab<GameObject>(
|
|
||||||
terrainName, "Data/model/mapterrain/", "model/mapterrain");
|
|
||||||
CUtil.AddChild(t, terrainObj, true);
|
|
||||||
TransformExtension.localEulerAngles(terrainObj.transform, 0, 0, 0);
|
|
||||||
TransformExtension.localPosition(terrainObj.transform, 0, 0, 0);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
var b = new Battle(join_info);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
13
Objects/Actor.cs
Normal file
13
Objects/Actor.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace cfclient.Objects
|
||||||
|
{
|
||||||
|
class Actor : WorldObject
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
12
Objects/Car.cs
Normal file
12
Objects/Car.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace cfclient.Objects
|
||||||
|
{
|
||||||
|
class Car : Actor
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
12
Objects/Player.cs
Normal file
12
Objects/Player.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace cfclient.Objects
|
||||||
|
{
|
||||||
|
class Player : Actor
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
16
Objects/WorldObject.cs
Normal file
16
Objects/WorldObject.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace cfclient.Objects
|
||||||
|
{
|
||||||
|
class WorldObject
|
||||||
|
{
|
||||||
|
private int uniid;
|
||||||
|
private Vector3 serverPos = new Vector3();
|
||||||
|
private GameObject gameObject;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user