예제 #1
0
            public void OnLoadSucc <T>(T source, UnityObject obj)
            {
                if (_param == null)
                {
                    _dataSource.AddRecycleObject(obj);
                    return;
                }

                if (obj.Address.Equals(_param.P3DefaultResAddr) ||
                    obj.Address.Equals(_param.P1DefaultResAddr))
                {
                    if (_param.DefaultGameObject == null)
                    {
                        _param.DefaultGameObject = obj;
                        SetObjParam(_param.DefaultGameObject, UnityLayerManager.GetLayerIndex(EUnityLayerName.Player));
                    }
                    else
                    {
                        _dataSource.AddRecycleObject(obj);
                    }
                }
                else if (_param.HasAlterAppearance && obj.Address.Equals(_param.AlterResAddr))
                {
                    if (_param.AlternativeGameObject == null)
                    {
                        _param.AlternativeGameObject = obj;
                        SetObjParam(_param.AlternativeGameObject, UnityLayerManager.GetLayerIndex(EUnityLayerName.Player));
                    }
                    else
                    {
                        _dataSource.AddRecycleObject(obj);
                    }
                }
                else
                {
                    _dataSource.AddRecycleObject(obj);
                }

                if (_param.DefaultGameObject != null &&
                    _param.HasAlterAppearance == (_param.AlternativeGameObject != null))
                {
                    _param.PrepareMasks();
                    if (_loadFinishHandle != null)
                    {
                        _loadFinishHandle.Invoke(_param);
                    }
                    _dataSource.FinishLoadResource(_param, _index);
                    _param = null;
                }
            }
            public void OnLoadSuccess <T>(T source, UnityObject obj)
            {
                if (_param == null)
                {
                    _dataSource.AddRecycleObject(obj);
                    return;
                }

                if (null == obj || null == obj.AsGameObject)
                {
                    _dataSource.AddRecycleObject(_param.DefaultGameObject);
                    _dataSource.AddRecycleObject(_param.AlternativeGameObject);
                    return;
                }

                if (!obj.AsGameObject.activeSelf)
                {
                    Logger.ErrorFormat("unityObj:  {0}  is unActive", obj.Address);
                    return;
                }

                Logger.InfoFormat("CharacterLog-- Wardrobe Load Success: {0}", obj.Address);

                if (obj.Address.Equals(_param.P3DefaultResAddr) ||
                    obj.Address.Equals(_param.P1DefaultResAddr))
                {
                    if (_param.DefaultGameObject == null)
                    {
                        _param.DefaultGameObject = obj;
                        SetObjParam(_param.DefaultGameObject, UnityLayerManager.GetLayerIndex(EUnityLayerName.Player));
                    }
                    else
                    {
                        _dataSource.AddRecycleObject(obj);
                    }
                }
                else if (_param.HasAlterAppearance && obj.Address.Equals(_param.AlterResAddr))
                {
                    if (_param.AlternativeGameObject == null)
                    {
                        _param.AlternativeGameObject = obj;
                        SetObjParam(_param.AlternativeGameObject, UnityLayerManager.GetLayerIndex(EUnityLayerName.Player));
                    }
                    else
                    {
                        _dataSource.AddRecycleObject(obj);
                    }
                }
                else
                {
                    _dataSource.AddRecycleObject(obj);
                }

                if (_param.DefaultGameObject != null &&
                    _param.HasAlterAppearance == (_param.AlternativeGameObject != null))
                {
                    _param.PrepareMasks();
                    if (_loadFinishHandle != null)
                    {
                        _loadFinishHandle.Invoke(_param);
                    }
                    _dataSource.FinishLoadResource(_param, _index);
                    _param = null;
                }
            }