Пример #1
0
    public void OnOpenWindow(object[] all_params)
    {
        string ui_name = all_params[0] as string;

        if (all_layouts.ContainsKey(ui_name))
        {
            Debug.LogError("打开界面,已经存在界面:  " + ui_name);

            return;
        }

        GDSKit.ui_config config = GDSKit.ui_config.GetInstance(ui_name);

        System.Type ui_type = System.Type.GetType(config.class_name);

        UILayoutBase layout = System.Activator.CreateInstance(ui_type) as UILayoutBase;

        layout.config   = config;
        layout.is_show  = true;
        layout.game_obj = ObjectPoolManager.Instance().GetObject(config.resource_name);
        layout.game_obj.transform.SetParent(cache_root, false);
        layout.OnInit();

        all_layouts.Add(ui_name, layout);
    }
Пример #2
0
        public static void AddInstance(ui_config obj)
        {
            string _key_ = obj.GetKeyInDict();

            if (_dict_.ContainsKey(_key_))
            {
                UnityEngine.Debug.LogWarning("在名为ui_config的GDS文件中已经存在: " + _key_);
                return;
            }
            _dict_.Add(_key_, obj);
        }
Пример #3
0
        private static ui_config CreateInstance(string[] objArr)
        {
            ui_config _ret_ = new ui_config();

            _ret_.layout_name = String.Intern(CSVParser.GetAsString(objArr[0]));

            _ret_.resource_name = String.Intern(CSVParser.GetAsString(objArr[1]));

            _ret_.class_name = String.Intern(CSVParser.GetAsString(objArr[2]));



            return(_ret_);
        }
Пример #4
0
        public static void Initialize(List <string[]> data)
        {
            if (_isInited_)
            {
                return;
            }

            foreach (var objArr in data)
            {
                ui_config _value_ = CreateInstance(objArr);
                PostProcessor(_value_);
                string _key_ = _value_.GetKeyInDict();

                _dict_.Add(_key_, _value_);
            }

            _isInited_ = true;
        }
Пример #5
0
        public static ui_config GetInstance(string layout_name)
        {
            if (!_isInited_)
            {
                return(null);
            }
            string _key_ = layout_name.ToString();

            if (null != _externalDataSource_)
            {
                return(_externalDataSource_.Invoke(typeof(ui_config), _key_) as ui_config);
            }
            else
            {
                ui_config _ret_ = null;
                if (!_dict_.TryGetValue(_key_, out _ret_))
                {
                    throw new Exception("在名为ui_config的GDS文件中没有发现key : " + _key_);
                }
                return(_ret_);
            }
        }
Пример #6
0
 static partial void PostProcessor(ui_config instance);