virtual public void ClearScriptObject() { if (mIsDestory) { return; } mIsDestory = true; CallFunctionVoid("OnDestroy"); if (mOnGUIDelegate != null) { mOnGUIDelegate.Dispose(); mOnGUIDelegate = null; } if (mLateUpdateDelegate != null) { mLateUpdateDelegate.Dispose(); mLateUpdateDelegate = null; } if (mFixedUpdateDelegate != null) { mFixedUpdateDelegate.Dispose(); mFixedUpdateDelegate = null; } if (mUpdateDelegate != null) { mUpdateDelegate.Dispose(); mUpdateDelegate = null; } mObject = null; mScriptType = null; mCodeTool = null; }
virtual public void InitScript(string _class, string _AppName) { if (_class.Length == 0 || mInitScript) { return; } if (_AppName.Equals(cNeedSetAppName)) { DLog.LOGColor(DLogType.Error, string.Format("必须设置正确的AppName.Class = {0},GameObject = {1}", _class, gameObject.name), LogColor.YELLO); return; } try { mAppName = _AppName; mCore = AppCore.App[mAppName]; mCodeTool = mCore.SManager.CodeTool; mScriptClass = _class; mScriptType = mCodeTool.GetLType(mScriptClass); mObject = mCodeTool.GetCSLEObjectParmasByType(mScriptType, this); InitParamList(); mCore.AddScriptInterface(this); CallScriptFunctionByName("Awake"); mInitScript = true; } catch (Exception _erro) { DLog.LogError(string.Format("脚本初始化出错:Class = {0},AppName = {1},GameObject = {2},InitScript ->{3}", mScriptClass, mAppName, gameObject.name, _erro.ToString())); } }
public BuilderObjectWriterArrayCSLS(CodeToolBase _codetool, object _object) : base(_codetool, _object) { if (mObject != null) { mList = new ArrayList((ICollection)mObject); } }
public static void BuildChild(CodeToolBase _codetool, object _fieldobj, ProtoBufferWriterCSLS _writer) { if (_fieldobj == null) { _writer.FieldNumberForward(); return; } BuilderObjectWriterBaseCSLS tobj = null; if (_codetool.IsLSType(_fieldobj.GetType())) { tobj = new BuilderObjectWriterObjectCSLS(_codetool, _fieldobj); } else { Type ttype = _fieldobj.GetType(); if (ttype.ToString().Contains("List")) { tobj = new BuilderObjectWriterArrayCSLS(_codetool, _fieldobj); } else { tobj = new BuilderObjectWriterDefaultCSLS(_codetool, _fieldobj); } } tobj.WriteMember(_writer); }
public object GetCSLEObject(CodeToolBase _codetool, string _classname) { if (mCSLEObject == null) { mCSLEObject = ProtoBufferReaderBuilderCSLS.GetCSLEObject(_codetool, mData, mLen, _classname); } return(mCSLEObject); }
public ProtoBufferWriterBuilderCSLS(CodeToolBase _codetool, object _object) { mCodeTool = _codetool; mObject = _object; mType = mCodeTool.GetObjectType(_object); mWriter = new ProtoBufferWriterCSLS(); BuildMember(); }
public BuilderObjectBase(CodeToolBase _codetool, int _fieldnumber, int _fieldindex, object _parent, IType _type, IType _parenttype) { mFieldNumber = _fieldnumber; mFieldIndex = _fieldindex; mParentObject = _parent; mFunType = _type; mParentType = _parenttype; mCodeTool = _codetool; }
public ProtoBufferReaderBuilderCSLS(CodeToolBase _codetool, byte[] _buffer, int _len, string _classname) { mCodeTool = _codetool; mReader = new ProtobufferReaderCSLS(_buffer, _len); mClassName = _classname; InitType(); mScriptObject = mCodeTool.GetCSLEObjectParmasByType(mScriptType); BuildMember(); }
static public object GetCSLEObject(CodeToolBase _codetool, byte[] _buffer, int _len, string _classname) { if (string.IsNullOrEmpty(_classname)) { return(null); } ProtoBufferReaderBuilderCSLS tcslspro = new ProtoBufferReaderBuilderCSLS(_codetool, _buffer, _len, _classname); return(tcslspro.Value); }
public BuilderObjectCELSArray(CodeToolBase _codetool, int _fieldnumber, int _fieldindex, object _parent, IType _type, IType _parenttype, IType _ChildType) : base(_codetool, _fieldnumber, _fieldindex, _parent, _type, _parenttype) { mChildType = _ChildType; mSelfObject = mCodeTool.GetMemberByIndex(mParentType, mFieldIndex, _parent); if (mSelfObject == null) { mSelfObject = Activator.CreateInstance(mFunType.TypeForCLR, true); mCodeTool.SetMember(mParentType, mFieldIndex, mSelfObject, mParentObject); } if (mSelfObject == null) { throw new InvalidOperationException("数组类变量为空,初始化对象失败,可尝试在定义时直接初始化: " + mFieldIndex); } }
virtual protected void InitScriptOnAwake() { if (string.IsNullOrEmpty(mScriptClass) || mInitScript) { return; } try { mCodeTool = GameCore.CodeTool; mScriptType = mCodeTool.GetLType(mScriptClass); mObject = mCodeTool.GetObject(mScriptClass, this); InitParamList(); InitInterface(); mInitScript = true; } catch (Exception _erro) { DLog.LogError(string.Format("脚本初始化出错:Class = {0},GameObject = {1},InitScript ->{2}", mScriptClass, gameObject.name, _erro.ToString())); } }
virtual public void ClearScriptObject() { if (mIsDestory) { return; } mIsDestory = true; CallScriptFunctionByName("OnDestroy"); if (mCore != null) { mCore.RemveScriptInterface(this); mCore = null; } if (mOnGUIDelegate != null) { mOnGUIDelegate.Dispose(); mOnGUIDelegate = null; } if (mLateUpdateDelegate != null) { mLateUpdateDelegate.Dispose(); mLateUpdateDelegate = null; } if (mFixedUpdateDelegate != null) { mFixedUpdateDelegate.Dispose(); mFixedUpdateDelegate = null; } if (mUpdateDelegate != null) { mUpdateDelegate.Dispose(); mUpdateDelegate = null; } mObject = null; mScriptType = null; mCodeTool = null; }
public BuilderObjectCELSClass(CodeToolBase _codetool, int _fieldnumber, int _fieldindex, object _parent, IType _type, IType _parenttype) : base(_codetool, _fieldnumber, _fieldindex, _parent, _type, _parenttype) { mSelfObject = mCodeTool.GetCSLEObjectParmasByType(mFunType); if (mSelfObject == null) { throw new InvalidOperationException("未能取得对象 " + ":" + mFunType.TypeForCLR.Name); } if (mParentType != null && mParentObject != null) { mCodeTool.SetMember(mParentType, mFieldIndex, mSelfObject, mParentObject); } IType[] ttypes = mCodeTool.GetFieldTypes(mFunType); int tindex = 1; for (int i = 0; i < ttypes.Length; i++) { BuilderObjectBase tobj = BuilderObjectBase.GetMember(_codetool, ttypes[i], i, tindex++, mSelfObject, mFunType); AddMember(tobj); } }
static public BuilderObjectBase GetMember(CodeToolBase _codetool, IType _fieldtype, int _fieldindex, int _index, object _parent, IType _parenttype) { if (_codetool.IsLSType(_fieldtype.TypeForCLR)) { return(new BuilderObjectCELSClass(_codetool, _index, _fieldindex, _parent, _fieldtype, _parenttype)); } else { string ttypestring = _fieldtype.TypeForCLR.ToString(); if (ttypestring.Contains("List")) { IType tatyp = _codetool.GetListChildType(_fieldtype);//包含类型 if (tatyp == null) { DLog.LogError("获取数组基础类型失败(" + _fieldtype + "|" + ttypestring + "|" + tatyp + ")"); } return(new BuilderObjectCELSArray(_codetool, _index, _fieldindex, _parent, _fieldtype, _parenttype, tatyp)); } else { return(new BuilderObjectDefault(_codetool, _index, _fieldindex, _parent, _fieldtype, _parenttype)); } } }
public void AddCSLEObject(CodeToolBase _codetool, object _object) { ProtoBufferWriterBuilderCSLS twbuilder = new ProtoBufferWriterBuilderCSLS(_codetool, _object); AddBytes(twbuilder.GetBuffer()); }
public BuilderObjectWriterBaseCSLS(CodeToolBase _codetool, object _object) { mCodeTool = _codetool; mObject = _object; }
public BuilderObjectDefault(CodeToolBase _codetool, int _fieldnumber, int _fieldindex, object _parent, IType _type, IType _parenttype) : base(_codetool, _fieldnumber, _fieldindex, _parent, _type, _parenttype) { mType = _type.TypeForCLR; }
public BuilderObjectWriterObjectCSLS(CodeToolBase _codetool, object _object) : base(_codetool, _object) { mType = mCodeTool.GetObjectType(mObject); }
public BuilderObjectWriterDefaultCSLS(CodeToolBase _codetool, object _object) : base(_codetool, _object) { }