Ejemplo n.º 1
0
        public override void RegisterPropertyCallback(AFIDENTID self, string strPropertyName, AFIProperty.PropertyEventHandler handler)
        {
            AFIObject xGameObject = GetObject(self);

            if (null != xGameObject)
            {
                xGameObject.GetPropertyManager().RegisterCallback(strPropertyName, handler);
            }
        }
Ejemplo n.º 2
0
        public override void RegisterRecordCallback(AFIDENTID self, string strRecordName, AFIRecord.RecordEventHandler handler)
        {
            AFIObject xGameObject = GetObject(self);

            if (null != xGameObject)
            {
                xGameObject.GetRecordManager().RegisterCallback(strRecordName, handler);
            }
        }
Ejemplo n.º 3
0
        public override void RegisterEventCallBack(AFIDENTID self, int nEventID, AFIEvent.EventHandler handler, AFIDataList valueList)
        {
            AFIObject xGameObject = GetObject(self);

            if (null != xGameObject)
            {
                xGameObject.GetEventManager().RegisterCallback(nEventID, handler, valueList);
            }
        }
Ejemplo n.º 4
0
        public override string QueryPropertyString(AFIDENTID self, string strPropertyName)
        {
            if (mhtObject.ContainsKey(self))
            {
                AFIObject xGameObject = (AFIObject)mhtObject[self];
                return(xGameObject.QueryPropertyString(strPropertyName));
            }

            return("");
        }
Ejemplo n.º 5
0
        public override double QueryPropertyDouble(AFIDENTID self, string strPropertyName)
        {
            if (mhtObject.ContainsKey(self))
            {
                AFIObject xGameObject = (AFIObject)mhtObject[self];
                return(xGameObject.QueryPropertyDouble(strPropertyName));
            }

            return(0.0);
        }
Ejemplo n.º 6
0
        public override float QueryPropertyFloat(AFIDENTID self, string strPropertyName)
        {
            if (mhtObject.ContainsKey(self))
            {
                AFIObject xGameObject = (AFIObject)mhtObject[self];
                return(xGameObject.QueryPropertyFloat(strPropertyName));
            }

            return(0.0f);
        }
Ejemplo n.º 7
0
        public override bool SetPropertyObject(AFIDENTID self, string strPropertyName, AFIDENTID objectValue)
        {
            if (mhtObject.ContainsKey(self))
            {
                AFIObject xGameObject = (AFIObject)mhtObject[self];
                return(xGameObject.SetPropertyObject(strPropertyName, objectValue));
            }

            return(false);
        }
Ejemplo n.º 8
0
        public override bool FindProperty(AFIDENTID self, string strPropertyName)
        {
            if (mhtObject.ContainsKey(self))
            {
                AFIObject xGameObject = (AFIObject)mhtObject[self];
                return(xGameObject.FindProperty(strPropertyName));
            }

            return(false);
        }
Ejemplo n.º 9
0
        public override bool UpDate(float fTime)
        {
            foreach (AFIDENTID id in mhtObject.Keys)
            {
                AFIObject xGameObject = (AFIObject)mhtObject[id];
                xGameObject.GetHeartBeatManager().Update(fTime);
            }

            return(true);
        }
Ejemplo n.º 10
0
        public override AFIDENTID QueryPropertyObject(AFIDENTID self, string strPropertyName)
        {
            if (mhtObject.ContainsKey(self))
            {
                AFIObject xGameObject = (AFIObject)mhtObject[self];
                return(xGameObject.QueryPropertyObject(strPropertyName));
            }

            return(new AFIDENTID());
        }
Ejemplo n.º 11
0
        public override AFIRecord FindRecord(AFIDENTID self, string strRecordName)
        {
            if (mhtObject.ContainsKey(self))
            {
                AFIObject xGameObject = (AFIObject)mhtObject[self];
                return(xGameObject.GetRecordManager().GetRecord(strRecordName));
            }

            return(null);
        }
Ejemplo n.º 12
0
        public override AFIDENTID QueryRecordObject(AFIDENTID self, string strRecordName, int nRow, int nCol)
        {
            if (mhtObject.ContainsKey(self))
            {
                AFIObject xGameObject = (AFIObject)mhtObject[self];
                return(xGameObject.QueryRecordObject(strRecordName, nRow, nCol));
            }

            return(new AFIDENTID());
        }
Ejemplo n.º 13
0
        public override double QueryRecordDouble(AFIDENTID self, string strRecordName, int nRow, int nCol)
        {
            if (mhtObject.ContainsKey(self))
            {
                AFIObject xGameObject = (AFIObject)mhtObject[self];
                return(xGameObject.QueryRecordDouble(strRecordName, nRow, nCol));
            }

            return(0.0);
        }
Ejemplo n.º 14
0
        public override bool AddHeartBeat(AFIDENTID self, string strHeartBeatName, AFIHeartBeat.HeartBeatEventHandler handler, float fTime, AFIDataList valueList)
        {
            AFIObject xGameObject = GetObject(self);

            if (null != xGameObject)
            {
                xGameObject.GetHeartBeatManager().AddHeartBeat(strHeartBeatName, fTime, handler, valueList);
            }
            return(true);
        }
Ejemplo n.º 15
0
        public override bool SetRecordObject(AFIDENTID self, string strRecordName, int nRow, int nCol, AFIDENTID objectValue)
        {
            if (mhtObject.ContainsKey(self))
            {
                AFIObject xGameObject = (AFIObject)mhtObject[self];
                return(xGameObject.SetRecordObject(strRecordName, nRow, nCol, objectValue));
            }

            return(false);
        }
Ejemplo n.º 16
0
        public override bool FindHeartBeat(AFIDENTID self, string strHeartBeatName)
        {
            AFIObject xGameObject = GetObject(self);

            if (null != xGameObject)
            {
                //gameObject.GetHeartBeatManager().AddHeartBeat()
            }

            return(false);
        }
Ejemplo n.º 17
0
        public override int FindRecordRow(AFIDENTID self, string strRecordName, int nCol, AFIDENTID nValue)
        {
            if (mhtObject.ContainsKey(self))
            {
                AFIObject          xGameObject = (AFIObject)mhtObject[self];
                AFCoreEx.AFIRecord xRecord     = xGameObject.GetRecordManager().GetRecord(strRecordName);
                if (null != xRecord)
                {
                    return(xRecord.FindObject(nCol, nValue));
                }
            }

            return(-1);
        }
Ejemplo n.º 18
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());
            }
        }
Ejemplo n.º 19
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());
            }
        }
Ejemplo n.º 20
0
        public override bool DestroyObject(AFIDENTID self)
        {
            if (mhtObject.ContainsKey(self))
            {
                AFIObject xGameObject = (AFIObject)mhtObject[self];

                string strClassName = xGameObject.ClassName();

                ClassHandleDel xHandleDel = (ClassHandleDel)mhtClassHandleDel[strClassName];
                if (null != xHandleDel && null != xHandleDel.GetHandler())
                {
                    AFIObject.ClassEventHandler xHandlerList = xHandleDel.GetHandler();
                    xHandlerList(self, xGameObject.ContainerID(), xGameObject.GroupID(), AFIObject.CLASS_EVENT_TYPE.OBJECT_DESTROY, xGameObject.ClassName(), xGameObject.ConfigIndex());
                }
                mhtObject.Remove(self);

                //AFCLog.Instance.Log(AFCLog.LOG_LEVEL.DEBUG, "Destroy object: " + self.ToString() + " ClassName: " + strClassName + " SceneID: " + xGameObject.ContainerID() + " GroupID: " + xGameObject.GroupID());

                return(true);
            }

            return(false);
        }
Ejemplo n.º 21
0
        public static void Main()
        {
            AFIKernel kernel = new AFCKernel();

            Console.WriteLine("****************AFIDataList******************");

            AFIDataList var = new AFCDataList();

            for (int i = 0; i < 9; i += 3)
            {
                var.AddInt64(i);
                var.AddFloat((float)i + 1);
                var.AddString((i + 2).ToString());
            }

            for (int i = 0; i < 9; i += 3)
            {
                Int64  n   = var.Int64Val(i);
                float  f   = var.FloatVal(i + 1);
                string str = var.StringVal(i + 2);
                Console.WriteLine(n);
                Console.WriteLine(f);
                Console.WriteLine(str);
            }


            Console.WriteLine("***************AFProperty*******************");

            AFIDENTID ident      = new AFIDENTID(0, 1);
            AFIObject gameObject = kernel.CreateObject(ident, 0, 0, "", "", new AFCDataList());

            AFIDataList valueProperty = new AFCDataList();

            valueProperty.AddInt64(112221);
            gameObject.GetPropertyManager().AddProperty("111", valueProperty);
            Console.WriteLine(gameObject.QueryPropertyInt("111"));

            Console.WriteLine("***************AFRecord*******************");

            AFIDataList valueRecord = new AFCDataList();

            valueRecord.AddInt64(0);
            valueRecord.AddFloat(0);
            valueRecord.AddString("");
            valueRecord.AddObject(ident);

            gameObject.GetRecordManager().AddRecord("testRecord", 10, valueRecord);

            kernel.SetRecordInt(ident, "testRecord", 0, 0, 112221);
            kernel.SetRecordFloat(ident, "testRecord", 0, 1, 1122210.0f);
            kernel.SetRecordString(ident, "testRecord", 0, 2, ";;;;;;112221");
            kernel.SetRecordObject(ident, "testRecord", 0, 3, ident);

            Console.WriteLine(gameObject.QueryRecordInt("testRecord", 0, 0));
            Console.WriteLine(gameObject.QueryRecordFloat("testRecord", 0, 1));
            Console.WriteLine(gameObject.QueryRecordString("testRecord", 0, 2));
            Console.WriteLine(gameObject.QueryRecordObject("testRecord", 0, 3));

            Console.WriteLine(" ");
            Console.WriteLine("***************PropertyAFEvent*******************");

            //挂属性回调,挂表回调
            kernel.RegisterPropertyCallback(ident, "111", OnPropertydHandler);
            kernel.SetPropertyInt(ident, "111", 2456);

            Console.WriteLine(" ");
            Console.WriteLine("***************RecordAFEvent*******************");

            kernel.RegisterRecordCallback(ident, "testRecord", OnRecordEventHandler);
            kernel.SetRecordInt(ident, "testRecord", 0, 0, 1111111);

            Console.WriteLine(" ");
            Console.WriteLine("***************ClassAFEvent*******************");

            kernel.RegisterClassCallBack("CLASSAAAAA", OnClassHandler);
            kernel.CreateObject(new AFIDENTID(0, 2), 0, 0, "CLASSAAAAA", "COAFIGINDEX", new AFCDataList());
            kernel.DestroyObject(new AFIDENTID(0, 2));


            Console.WriteLine(" ");
            Console.WriteLine("***************AFHeartBeat*******************");
            kernel.AddHeartBeat(new AFIDENTID(0, 1), "TestHeartBeat", HeartBeatEventHandler, 5.0f, new AFCDataList());

            while (true)
            {
                System.Threading.Thread.Sleep(1000);
                kernel.UpDate(1.0f);
            }
        }
Ejemplo n.º 22
0
        public void MainU3D()
        {
            Debug.Log("****************AFIDataList******************");

            AFIDataList var = new AFCDataList();

            for (int i = 0; i < 9; i += 3)
            {
                var.AddInt64(i);
                var.AddFloat((float)i + 1);
                var.AddString((i + 2).ToString());
            }

            for (int i = 0; i < 9; i += 3)
            {
                Int64  n   = var.Int64Val(i);
                float  f   = var.FloatVal(i + 1);
                string str = var.StringVal(i + 2);
                Debug.Log(n);
                Debug.Log(f);
                Debug.Log(str);
            }


            Debug.Log("***************AFProperty*******************");

            AFIDENTID ident      = new AFIDENTID(0, 1);
            AFIObject gameObject = xKernel.CreateObject(ident, 0, 0, "Player", "", new AFCDataList());

            AFIDataList valueProperty = new AFCDataList();

            valueProperty.AddInt64(112221);
            gameObject.GetPropertyManager().AddProperty("111", valueProperty);
            Debug.Log(gameObject.QueryPropertyInt("111"));

            Debug.Log("***************AFRecord*******************");

            AFIDataList valueRecord = new AFCDataList();

            valueRecord.AddInt64(0);
            valueRecord.AddFloat(0);
            valueRecord.AddString("");
            valueRecord.AddObject(ident);

            gameObject.GetRecordManager().AddRecord("testRecord", 10, valueRecord);

            xKernel.SetRecordInt(ident, "testRecord", 0, 0, 112221);
            xKernel.SetRecordFloat(ident, "testRecord", 0, 1, 1122210.0f);
            xKernel.SetRecordString(ident, "testRecord", 0, 2, ";;;;;;112221");
            xKernel.SetRecordObject(ident, "testRecord", 0, 3, ident);

            Debug.Log(gameObject.QueryRecordInt("testRecord", 0, 0));
            Debug.Log(gameObject.QueryRecordFloat("testRecord", 0, 1));
            Debug.Log(gameObject.QueryRecordString("testRecord", 0, 2));
            Debug.Log(gameObject.QueryRecordObject("testRecord", 0, 3));

            Debug.Log(" ");
            Debug.Log("***************PropertyAFEvent*******************");

            //挂属性回调,挂表回调
            xKernel.RegisterPropertyCallback(ident, "111", OnPropertydHandler);
            xKernel.SetPropertyInt(ident, "111", 2456);

            Debug.Log(" ");
            Debug.Log("***************RecordAFEvent*******************");

            xKernel.RegisterRecordCallback(ident, "testRecord", OnRecordEventHandler);
            xKernel.SetRecordInt(ident, "testRecord", 0, 0, 1111111);

            Debug.Log(" ");
            Debug.Log("***************ClassAFEvent*******************");

            xKernel.RegisterClassCallBack("CLASSAAAAA", OnClassHandler);
            xKernel.CreateObject(new AFIDENTID(0, 2), 0, 0, "CLASSAAAAA", "COAFIGINDEX", new AFCDataList());
            xKernel.DestroyObject(new AFIDENTID(0, 2));


            Debug.Log(" ");
            Debug.Log("***************AFHeartBeat*******************");
            xKernel.AddHeartBeat(new AFIDENTID(0, 1), "TestHeartBeat", HeartBeatEventHandler, 5.0f, new AFCDataList());
        }