From 45c82c513c67130bb52cb5e7f2f10c957e463cf1 Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期六, 27 十月 2018 11:36:55 +0800
Subject: [PATCH] 4340 【前端】支持xlua方便IOS提审

---
 System/WindowBase/ModelCenter.cs |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/System/WindowBase/ModelCenter.cs b/System/WindowBase/ModelCenter.cs
index 30dd71f..429a5d8 100644
--- a/System/WindowBase/ModelCenter.cs
+++ b/System/WindowBase/ModelCenter.cs
@@ -58,6 +58,7 @@
         bool inited = false;
 
         Dictionary<int, Model> models = new Dictionary<int, Model>();
+        Dictionary<string, Model> nameToModels = new Dictionary<string, Model>();
 
         public ModelCenter()
         {
@@ -221,15 +222,27 @@
             return model;
         }
 
+        public Model GetModel(string name)
+        {
+            if (nameToModels.ContainsKey(name))
+            {
+                return nameToModels[name];
+            }
+
+            return null;
+        }
+
         T RegisterModel<T>() where T : Model, new()
         {
             T model = null;
             var token = typeof(T).MetadataToken;
+            var name = typeof(T).Name;
 
             if (!models.ContainsKey(token))
             {
                 model = new T();
                 models[token] = model;
+                nameToModels[name] = model;
                 model.Init();
             }
 

--
Gitblit v1.8.0