Пример #1
0
        public bool Parse(string strData, out AFIDENTID id)
        {
            AFIDENTID xId = new AFIDENTID();

            id = xId;

            string[] strList = strData.Split('-');
            if (strList.Count() != 2)
            {
                return(false);
            }

            Int64 nHead = 0;

            if (!Int64.TryParse(strList[0], out nHead))
            {
                return(false);
            }

            Int64 nData = 0;

            if (!Int64.TryParse(strList[1], out nData))
            {
                return(false);
            }

            id.nHead64 = nHead;
            id.nData64 = nData;

            return(true);
        }
Пример #2
0
 public AFCRecord(AFIDENTID self, string strRecordName, int nRow, AFIDataList varData)
 {
     mSelf          = self;
     mnRow          = nRow;
     mstrRecordName = strRecordName;
     mVarRecordType = new AFCDataList(varData);
 }
Пример #3
0
        public override bool SetObject(int nRow, int nCol, AFIDENTID value)
        {
            if (nRow >= 0 && nRow < mnRow)
            {
                if (!mhtRecordVec.ContainsKey(nRow))
                {
                    AddRow(nRow);
                }
                AFIDataList valueList = (AFIDataList)mhtRecordVec[nRow];
                if (valueList.GetType(nCol) == AFIDataList.VARIANT_TYPE.VTYPE_OBJECT)
                {
                    if (valueList.ObjectVal(nCol) != value)
                    {
                        AFCDataList oldValue = new AFCDataList();
                        oldValue.AddObject(valueList.ObjectVal(nCol));

                        valueList.SetObject(nCol, value);

                        AFCDataList newValue = new AFCDataList();
                        newValue.AddObject(valueList.ObjectVal(nCol));

                        if (null != doHandleDel)
                        {
                            doHandleDel(mSelf, mstrRecordName, eRecordOptype.Updata, nRow, nCol, oldValue, newValue);
                        }
                    }
                }

                return(true);
            }

            return(false);
        }
Пример #4
0
        private void ADD_ROW(AFCoreEx.AFIDENTID self, string strRecordName, AFMsg.DataTableAddRow xAddStruct)
        {
            AFIObject        go             = AFCKernel.Instance.GetObject(self);
            AFIRecordManager xRecordManager = go.GetRecordManager();


            Hashtable recordVecDesc = new Hashtable();
            Hashtable recordVecData = new Hashtable();

            AFCoreEx.AFCDataList RowList     = new AFCDataList();
            AFCoreEx.AFIDataList varListDesc = new AFCDataList();
            for (int k = 0; k < xAddStruct.CellList.Count; ++k)
            {
                AFMsg.PBCellData addStruct = (AFMsg.PBCellData)xAddStruct.CellList[k];
                if (addStruct.Col >= 0)
                {
                    int nRow = -1;
                    int nCol = -1;
                    AFCoreEx.AFIDataList.Var_Data xRowData = PBRecordToData(addStruct, ref nRow, ref nCol);
                    RowList.AddDataObject(ref xRowData);
                    varListDesc.AddDataObject(ref xRowData);
                }
            }

            AFIRecord xRecord = xRecordManager.GetRecord(strRecordName);

            if (null == xRecord)
            {
                xRecord = xRecordManager.AddRecord(strRecordName, 512, varListDesc);
            }

            xRecord.AddRow(xAddStruct.Row, RowList);
        }
Пример #5
0
        public void RequirePickUpItem(AFCoreEx.AFIDENTID objectID, AFCoreEx.AFIDENTID nItemID)
        {
            AFMsg.ReqPickDropItem xData = new AFMsg.ReqPickDropItem();
            xData.ItemGuid = AFToPB(nItemID);

            SendMsg(objectID, AFMsg.EGameMsgID.EgmiReqPickItem, xData);
        }
Пример #6
0
        //有可能是他副本的NPC移动,因此增加64对象ID
        public void RequireUseSkill(AFCoreEx.AFIDENTID objectID, string strKillID, AFCoreEx.AFIDENTID nTargetID, float fNowX, float fNowZ, float fTarX, float fTarZ)
        {
            //Debug.Log("RequireUseSkill:" + strKillID);

            AFMsg.Position xNowPos = new AFMsg.Position();
            AFMsg.Position xTarPos = new AFMsg.Position();

            xNowPos.X = fNowX;
            xNowPos.Y = 0.0f;
            xNowPos.Z = fNowZ;
            xTarPos.X = fTarX;
            xTarPos.Y = 0.0f;
            xTarPos.Z = fTarZ;

            AFMsg.ReqAckUseSkill xData = new AFMsg.ReqAckUseSkill();
            xData.User    = AFToPB(objectID);
            xData.SkillId = strKillID;
            xData.TarPos  = xTarPos;
            xData.NowPos  = xNowPos;

            if (!nTargetID.IsNull())
            {
                AFMsg.EffectData xEffectData = new AFMsg.EffectData();

                xEffectData.EffectIdent = AFToPB(nTargetID);
                xEffectData.EffectValue = 0;
                xEffectData.EffectRlt   = 0;
                xData.EffectData.Add(xEffectData);
            }

            SendMsg(objectID, AFMsg.EGameMsgID.EgmiReqSkillObjectx, xData);
        }
Пример #7
0
        public void SendMsg(AFCoreEx.AFIDENTID xID, AFMsg.EGameMsgID unMsgID, IMessage xData)
        {
            MemoryStream stream = new MemoryStream();

            MessageExtensions.WriteTo(xData, stream);
            SendMsg(xID, unMsgID, stream);
        }
Пример #8
0
        static public AFCoreEx.AFIDENTID PBToAF(AFMsg.PBGUID xID)
        {
            AFCoreEx.AFIDENTID xIdent = new AFCoreEx.AFIDENTID();
            xIdent.nHead64 = xID.High;
            xIdent.nData64 = xID.Low;

            return(xIdent);
        }
Пример #9
0
        static public AFMsg.PBGUID AFToPB(AFCoreEx.AFIDENTID xID)
        {
            AFMsg.PBGUID xIdent = new AFMsg.PBGUID();
            xIdent.High = xID.nHead64;
            xIdent.Low  = xID.nData64;

            return(xIdent);
        }
Пример #10
0
 public AFCHeartBeat(AFIDENTID self, string strHeartBeatName, float fTime, AFIDataList valueList)
 {
     mSelf             = self;
     mstrHeartBeatName = strHeartBeatName;
     mfTime            = fTime;
     mfOldTime         = fTime;
     mArgValueList     = valueList;
 }
Пример #11
0
        public override void RegisterRecordCallback(AFIDENTID self, string strRecordName, AFIRecord.RecordEventHandler handler)
        {
            AFIObject xGameObject = GetObject(self);

            if (null != xGameObject)
            {
                xGameObject.GetRecordManager().RegisterCallback(strRecordName, handler);
            }
        }
Пример #12
0
        public override void RegisterPropertyCallback(AFIDENTID self, string strPropertyName, AFIProperty.PropertyEventHandler handler)
        {
            AFIObject xGameObject = GetObject(self);

            if (null != xGameObject)
            {
                xGameObject.GetPropertyManager().RegisterCallback(strPropertyName, handler);
            }
        }
Пример #13
0
        /////////////////////////////////////////////////////////////

        //public override bool AddRecordCallBack( AFIDENTID self, string strRecordName, RECORD_EVENT_FUNC cb );

        //public override bool AddPropertyCallBack( AFIDENTID self, string strCriticalName, PROPERTY_EVENT_FUNC cb );

        //     public override bool AddClassCallBack( string strClassName, CLASS_EVENT_FUNC cb );
        //
        //     public override bool RemoveClassCallBack( string strClassName, CLASS_EVENT_FUNC cb );

        /////////////////////////////////////////////////////////////////

        public override AFIObject GetObject(AFIDENTID ident)
        {
            if (null != ident && mhtObject.ContainsKey(ident))
            {
                return((AFIObject)mhtObject[ident]);
            }

            return(null);
        }
Пример #14
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);
            }
        }
Пример #15
0
 public AFCObject(AFIDENTID self, int nContainerID, int nGroupID, string strClassName, string strConfigIndex)
 {
     mSelf           = self;
     mstrClassName   = strClassName;
     mstrConfigIndex = strConfigIndex;
     mnContainerID   = nContainerID;
     mnGroupID       = nGroupID;
     Init();
 }
Пример #16
0
        public void RequireDelRole(AFCoreEx.AFIDENTID objectID, string strAccount, string strRoleName, int nGameID)
        {
            AFMsg.ReqDeleteRole xData = new AFMsg.ReqDeleteRole();
            xData.Name    = strRoleName;
            xData.Account = strAccount;
            xData.GameId  = nGameID;

            SendMsg(objectID, AFMsg.EGameMsgID.EgmiReqDeleteRole, xData);
        }
Пример #17
0
 static void HeartBeatEventHandler(AFIDENTID self, string strHeartBeat, float fTime, AFIDataList valueList)
 {
     Console.Write(self);
     Console.Write(" ");
     Console.Write(strHeartBeat);
     Console.Write(" ");
     Console.Write(fTime.ToString());
     Console.WriteLine(" ");
 }
Пример #18
0
        private void SendMsg(AFCoreEx.AFIDENTID xID, AFMsg.EGameMsgID unMsgID, MemoryStream stream)
        {
            MsgHead head = new MsgHead();

            head.unMsgID = (UInt16)unMsgID;
            head.nHead64 = xID.nHead64;
            head.nData64 = xID.nData64;
            mxPlayerNet.mxNet.SendMsg(head, stream.ToArray());
        }
Пример #19
0
        public void RequireSwapScene(AFCoreEx.AFIDENTID objectID, int nTransferType, int nSceneID, int nLineIndex)
        {
            AFMsg.ReqAckSwapScene xData = new AFMsg.ReqAckSwapScene();
            xData.TransferType = (AFMsg.ReqAckSwapScene.Types.EGameSwapType)nTransferType;
            xData.SceneId      = nSceneID;
            xData.LineId       = nLineIndex;

            SendMsg(objectID, AFMsg.EGameMsgID.EgmiReqSwapScene, xData);
        }
Пример #20
0
        public void RequireChat(AFCoreEx.AFIDENTID objectID, AFCoreEx.AFIDENTID targetID, int nType, string strData)
        {
            AFMsg.ReqAckPlayerChat xData = new AFMsg.ReqAckPlayerChat();
            xData.ChatId   = AFToPB(targetID);
            xData.ChatType = (AFMsg.ReqAckPlayerChat.Types.EGameChatType)nType;
            xData.ChatInfo = strData;

            SendMsg(objectID, AFMsg.EGameMsgID.EgmiReqChat, xData);
        }
Пример #21
0
 public void RequireEnterGameServer(AFCoreEx.AFIDENTID objectID, string strAccount, string strRoleName, int nServerID)
 {
     AFMsg.ReqEnterGameServer xData = new AFMsg.ReqEnterGameServer();
     xData.Name    = strRoleName;
     xData.Account = strAccount;
     xData.GameId  = nServerID;
     xData.Id      = AFToPB(objectID);
     SendMsg(objectID, AFMsg.EGameMsgID.EgmiReqEnterGame, xData);
 }
Пример #22
0
        public override bool AddObject(AFIDENTID value)
        {
            Var_Data data = new Var_Data();

            data.nType = VARIANT_TYPE.VTYPE_OBJECT;
            data.mData = value;

            return(AddDataObject(ref data));
        }
Пример #23
0
 static void HeartBeatEventHandler(AFIDENTID self, string strHeartBeat, float fTime, AFIDataList valueList)
 {
     Debug.Log(self);
     Debug.Log(" ");
     Debug.Log(strHeartBeat);
     Debug.Log(" ");
     Debug.Log(fTime.ToString());
     Debug.Log(" ");
 }
Пример #24
0
        public override string QueryPropertyString(AFIDENTID self, string strPropertyName)
        {
            if (mhtObject.ContainsKey(self))
            {
                AFIObject xGameObject = (AFIObject)mhtObject[self];
                return(xGameObject.QueryPropertyString(strPropertyName));
            }

            return("");
        }
Пример #25
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());
        }
Пример #26
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);
        }
Пример #27
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);
        }
Пример #28
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);
        }
Пример #29
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);
        }
Пример #30
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());
        }