1
This commit is contained in:
parent
83e0ee0957
commit
094f1d4f48
117
F6/MetaTable.cs
Normal file
117
F6/MetaTable.cs
Normal file
@ -0,0 +1,117 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace F6
|
||||
{
|
||||
public delegate bool TraverseCb<T>(T ele);
|
||||
|
||||
public interface IMetaTable
|
||||
{
|
||||
bool IsNoLoad()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void Load()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void PreInit1()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ElementsInit(int round)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void PostInit1()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class RawMetaTable<T>: IMetaTable
|
||||
{
|
||||
|
||||
|
||||
protected string fileName;
|
||||
protected string primKey;
|
||||
protected bool noLoad;
|
||||
protected List<T> rawList = new List<T>();
|
||||
|
||||
public void Traverse(TraverseCb<T> cb)
|
||||
{
|
||||
foreach(var item in this.rawList)
|
||||
{
|
||||
if (!cb(item))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public T RandElement()
|
||||
{
|
||||
if (this.rawList.Count > 0)
|
||||
{
|
||||
|
||||
return this.rawList[new Random().Next(0, this.rawList.Count)];
|
||||
}
|
||||
return default(T);
|
||||
}
|
||||
|
||||
public virtual void Load()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected virtual void LoadPost()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class IdMetaTable<T>: RawMetaTable<T>
|
||||
{
|
||||
protected Dictionary<Int64, T> idHash = new Dictionary<Int64, T> ();
|
||||
|
||||
public T GetById(Int64 id)
|
||||
{
|
||||
T v = default(T);
|
||||
this.idHash.TryGetValue(id, out v);
|
||||
return v;
|
||||
}
|
||||
|
||||
protected override void LoadPost()
|
||||
{
|
||||
base.LoadPost();
|
||||
}
|
||||
}
|
||||
|
||||
public class NameMetaTable<T>: RawMetaTable<T>
|
||||
{
|
||||
protected Dictionary<string, T> nameHash = new Dictionary<string, T>();
|
||||
|
||||
public T GetByName(string key)
|
||||
{
|
||||
T v = default(T);
|
||||
this.nameHash.TryGetValue(key, out v);
|
||||
return v;
|
||||
}
|
||||
|
||||
protected override void LoadPost()
|
||||
{
|
||||
base.LoadPost();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,13 +1,40 @@
|
||||
using UnityEngine;
|
||||
using LuaFramework;
|
||||
using BestHTTP;
|
||||
using BestHTTP.WebSocket;
|
||||
using System;
|
||||
using Newtonsoft;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class Test
|
||||
{
|
||||
//[Newtonsoft.Json.JsonConverter(typeof(string))]
|
||||
public string id;
|
||||
[Newtonsoft.Json.JsonProperty("Name")]
|
||||
public string name;
|
||||
public int age;
|
||||
}
|
||||
|
||||
public class BattleMgr
|
||||
{
|
||||
|
||||
|
||||
public static void StartBattle(JoinInfo join_info)
|
||||
{
|
||||
//CUILoading.OpenLoading();
|
||||
//CUILoading.SetLoading(0);
|
||||
string path = Application.dataPath;
|
||||
try
|
||||
{
|
||||
var test = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, string>>("{\"id\":123423.45454, \"Name\":\"Test\", \"age\":38.4344}");
|
||||
int i = 2;
|
||||
var t1 = new Test();
|
||||
|
||||
}catch(Exception e)
|
||||
{
|
||||
int i = 0;
|
||||
}
|
||||
|
||||
GameObject fightRootObject = new GameObject("fight");
|
||||
{
|
||||
fightRootObject.transform.parent = LuaHelper.GetGameManager().m_pGameMap.transform;
|
||||
@ -21,17 +48,32 @@ public class BattleMgr
|
||||
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);
|
||||
{
|
||||
var t = CUtil.AddChild(mapObj, mapBase, true);
|
||||
TransformExtension.localEulerAngles(t.transform, 0, 0, 0);
|
||||
TransformExtension.localPosition(t.transform, 0, 0, 0);
|
||||
}
|
||||
{
|
||||
var terrainName = "1_" + "map16";
|
||||
var terrainObj = LuaHelper.GetResManager().LoadPrefab<GameObject>(terrainName, "Data/model/mapterrain/", "model/mapterrain");
|
||||
terrainObj.localEulerAngle(terrainObj.tanasform, 0, 0, 0);
|
||||
terrainObj.localPosition(terrainObj.transfrom, 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void StartNet(JoinInfo join_info)
|
||||
{
|
||||
/*
|
||||
var m_webSocket = new WebSocket(new Uri("192.168.100.21"));
|
||||
m_webSocket.OnOpen += BattleMgr.OnOpen;
|
||||
m_webSocket.OnBinary += BattleMgr.OnBinaryReceived;
|
||||
m_webSocket.OnError += BattleMgr.OnError;
|
||||
m_webSocket.OnClosed += BattleMgr.OnClosed;
|
||||
m_webSocket.Open();*/
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
12
Mt/Equip.cs
Normal file
12
Mt/Equip.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.Mt
|
||||
{
|
||||
class Equip
|
||||
{
|
||||
}
|
||||
}
|
13
Mtb/Equip.cs
Normal file
13
Mtb/Equip.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.Mtb
|
||||
{
|
||||
class Equip
|
||||
{
|
||||
public int id { get; }
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user