コード例 #1
0
ファイル: AFCDataList.cs プロジェクト: cpiqq/ArkClient_Core
        public AFCDataList(AFIDataList src)
        {
            for (int i = 0; i < src.Count(); i++)
            {
                switch (src.GetType(i))
                {
                case VARIANT_TYPE.VTYPE_INT:
                    AddInt64(src.Int64Val(i));
                    break;

                case VARIANT_TYPE.VTYPE_FLOAT:
                    AddFloat(src.FloatVal(i));
                    break;

                case VARIANT_TYPE.VTYPE_DOUBLE:
                    AddDouble(src.DoubleVal(i));
                    break;

                case VARIANT_TYPE.VTYPE_STRING:
                    AddString(src.StringVal(i));
                    break;

                case VARIANT_TYPE.VTYPE_OBJECT:
                    AddObject(src.ObjectVal(i));
                    break;

                default:
                    break;
                }
            }
        }
コード例 #2
0
        void AddBasePropertyFormOther(string strName, string strOther)
        {
            AFILogicClass xOtherClass = GetElement(strOther);
            AFILogicClass xLogicClass = GetElement(strName);

            if (null != xLogicClass && null != xOtherClass)
            {
                AFIDataList xValue = xOtherClass.GetPropertyManager().GetPropertyList();
                for (int i = 0; i < xValue.Count(); ++i)
                {
                    AFIProperty xProperty = xOtherClass.GetPropertyManager().GetProperty(xValue.StringVal(i));
                    xLogicClass.GetPropertyManager().AddProperty(xValue.StringVal(i), xProperty.GetValue());
                }
            }
        }
コード例 #3
0
        void InitRecord(AFIDENTID self, string strClassName)
        {
            AFILogicClass xLogicClass = AFCLogicClassManager.Instance.GetElement(strClassName);

            if (null == xLogicClass)
            {
                return;
            }

            AFIDataList xDataList = xLogicClass.GetRecordManager().GetRecordList();

            for (int i = 0; i < xDataList.Count(); ++i)
            {
                string    strRecordyName = xDataList.StringVal(i);
                AFIRecord xRecord        = xLogicClass.GetRecordManager().GetRecord(strRecordyName);

                AFIObject        xObject        = GetObject(self);
                AFIRecordManager xRecordManager = xObject.GetRecordManager();

                xRecordManager.AddRecord(strRecordyName, xRecord.GetRows(), xRecord.GetColsData());
            }
        }
コード例 #4
0
        void InitProperty(AFIDENTID self, string strClassName)
        {
            AFILogicClass xLogicClass = AFCLogicClassManager.Instance.GetElement(strClassName);

            if (null == xLogicClass)
            {
                return;
            }

            AFIDataList xDataList = xLogicClass.GetPropertyManager().GetPropertyList();

            for (int i = 0; i < xDataList.Count(); ++i)
            {
                string      strPropertyName = xDataList.StringVal(i);
                AFIProperty xProperty       = xLogicClass.GetPropertyManager().GetProperty(strPropertyName);

                AFIObject          xObject          = GetObject(self);
                AFIPropertyManager xPropertyManager = xObject.GetPropertyManager();

                xPropertyManager.AddProperty(strPropertyName, xProperty.GetValue());
            }
        }
コード例 #5
0
ファイル: AFCObject.cs プロジェクト: cpiqq/ArkClient_Core
        public override bool Shut()
        {
            AFIDataList xRecordList = mRecordManager.GetRecordList();

            if (null != xRecordList)
            {
                for (int i = 0; i < xRecordList.Count(); ++i)
                {
                    string    strRecordName = xRecordList.StringVal(i);
                    AFIRecord xRecord       = mRecordManager.GetRecord(strRecordName);
                    if (null != xRecord)
                    {
                        xRecord.Clear();
                    }
                }
            }

            mRecordManager   = null;
            mPropertyManager = null;
            mHeartManager    = null;
            mEventManager    = null;

            return(true);
        }
コード例 #6
0
        public override AFIObject CreateObject(AFIDENTID self, int nContainerID, int nGroupID, string strClassName, string strConfigIndex, AFIDataList arg)
        {
            if (!mhtObject.ContainsKey(self))
            {
                AFIObject xNewObject = new AFCObject(self, nContainerID, nGroupID, strClassName, strConfigIndex);
                mhtObject.Add(self, xNewObject);

                AFCDataList varConfigID = new AFCDataList();
                varConfigID.AddString(strConfigIndex);
                xNewObject.GetPropertyManager().AddProperty("ConfigID", varConfigID);

                AFCDataList varConfigClass = new AFCDataList();
                varConfigClass.AddString(strClassName);
                xNewObject.GetPropertyManager().AddProperty("ClassName", varConfigClass);

                if (arg.Count() % 2 == 0)
                {
                    for (int i = 0; i < arg.Count() - 1; i += 2)
                    {
                        string strPropertyName         = arg.StringVal(i);
                        AFIDataList.VARIANT_TYPE eType = arg.GetType(i + 1);
                        switch (eType)
                        {
                        case AFIDataList.VARIANT_TYPE.VTYPE_INT:
                        {
                            AFIDataList xDataList = new AFCDataList();
                            xDataList.AddInt64(arg.Int64Val(i + 1));
                            xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList);
                        }
                        break;

                        case AFIDataList.VARIANT_TYPE.VTYPE_FLOAT:
                        {
                            AFIDataList xDataList = new AFCDataList();
                            xDataList.AddFloat(arg.FloatVal(i + 1));
                            xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList);
                        }
                        break;

                        case AFIDataList.VARIANT_TYPE.VTYPE_DOUBLE:
                        {
                            AFIDataList xDataList = new AFCDataList();
                            xDataList.AddDouble(arg.DoubleVal(i + 1));
                            xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList);
                        }
                        break;

                        case AFIDataList.VARIANT_TYPE.VTYPE_STRING:
                        {
                            AFIDataList xDataList = new AFCDataList();
                            xDataList.AddString(arg.StringVal(i + 1));
                            xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList);
                        }
                        break;

                        case AFIDataList.VARIANT_TYPE.VTYPE_OBJECT:
                        {
                            AFIDataList xDataList = new AFCDataList();
                            xDataList.AddObject(arg.ObjectVal(i + 1));
                            xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList);
                        }
                        break;

                        default:
                            break;
                        }
                    }
                }

                InitProperty(self, strClassName);
                InitRecord(self, strClassName);

                if (mhtClassHandleDel.ContainsKey(strClassName))
                {
                    ClassHandleDel xHandleDel = (ClassHandleDel)mhtClassHandleDel[strClassName];
                    if (null != xHandleDel && null != xHandleDel.GetHandler())
                    {
                        AFIObject.ClassEventHandler xHandlerList = xHandleDel.GetHandler();
                        xHandlerList(self, nContainerID, nGroupID, AFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE, strClassName, strConfigIndex);
                        xHandlerList(self, nContainerID, nGroupID, AFIObject.CLASS_EVENT_TYPE.OBJECT_LOADDATA, strClassName, strConfigIndex);
                        xHandlerList(self, nContainerID, nGroupID, AFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE_FINISH, strClassName, strConfigIndex);
                    }
                }

                //AFCLog.Instance.Log(AFCLog.LOG_LEVEL.DEBUG, "Create object: " + self.ToString() + " ClassName: " + strClassName + " SceneID: " + nContainerID + " GroupID: " + nGroupID);
                return(xNewObject);
            }

            return(null);
        }