コード例 #1
0
    public void RequireMoveImmune(NFCoreEx.NFIDENTID objectID, float fX, float fZ)
    {
        NFMsg.ReqAckPlayerMove xData = new NFMsg.ReqAckPlayerMove();
        xData.mover    = NFToPB(objectID);
        xData.moveType = 0;
        NFMsg.Position xTargetPos = new NFMsg.Position();
        xTargetPos.x = fX;
        xTargetPos.z = fZ;
        xData.target_pos.Add(xTargetPos);

        MemoryStream stream = new MemoryStream();

        Serializer.Serialize <NFMsg.ReqAckPlayerMove>(stream, xData);

        SendMsg(objectID, NFMsg.EGameMsgID.EGMI_REQ_MOVE_IMMUNE, stream);

        if (NFStart.Instance.bDebugMode)
        {
            NFMsg.MsgBase xAckData = new NFMsg.MsgBase();
            xAckData.player_id = xData.mover;
            xAckData.msg_data  = stream.ToArray();

            MemoryStream xAckBody = new MemoryStream();
            Serializer.Serialize <NFMsg.MsgBase>(xAckBody, xAckData);

            MsgHead head = new MsgHead();
            head.unMsgID   = (UInt16)NFMsg.EGameMsgID.EGMI_ACK_MOVE_IMMUNE;
            head.unDataLen = (UInt32)xAckBody.Length + (UInt32)ConstDefine.NF_PACKET_HEAD_SIZE;

            xNet.mxBinMsgEvent.OnMessageEvent(head, xAckBody.ToArray());
        }
    }
コード例 #2
0
    public void SendMsg(NFCoreEx.NFIDENTID xID, NFMsg.EGameMsgID unMsgID, MemoryStream stream)
    {
        if (NFStart.Instance.bDebugMode)
        {
            return;
        }

        NFMsg.MsgBase xData = new NFMsg.MsgBase();
        xData.player_id = NFToPB(xID);
        xData.msg_data  = stream.ToArray();

        MemoryStream body = new MemoryStream();

        Serializer.Serialize <NFMsg.MsgBase>(body, xData);

        MsgHead head = new MsgHead();

        head.unMsgID   = (UInt16)unMsgID;
        head.unDataLen = (UInt32)body.Length + (UInt32)ConstDefine.NF_PACKET_HEAD_SIZE;

        byte[] bodyByte = body.ToArray();
        byte[] headByte = StructureTransform.StructureToByteArrayEndian(head);


        byte[] sendBytes = new byte[head.unDataLen];
        headByte.CopyTo(sendBytes, 0);
        bodyByte.CopyTo(sendBytes, headByte.Length);

        xNet.mxClient.SendBytes(sendBytes);

        string strTime = DateTime.Now.Hour + ":" + DateTime.Now.Minute + ":" + DateTime.Now.Second;
        string strData = "S***:" + strTime + " MsgID:" + head.unMsgID + " Len:" + head.unDataLen;

        xNet.mxListener.aMsgList.Add(strData);
    }
コード例 #3
0
    //有可能是他副本的NPC移动,因此增加64对象ID
    public void RequireUseSkill(NFCoreEx.NFIDENTID objectID, string strKillID, NFCoreEx.NFIDENTID nTargetID, float fNowX, float fNowZ, float fTarX, float fTarZ)
    {
        NFMsg.Position xNowPos = new NFMsg.Position();
        NFMsg.Position xTarPos = new NFMsg.Position();

        xNowPos.x = fNowX;
        xNowPos.y = 0.0f;
        xNowPos.z = fNowZ;
        xTarPos.x = fTarX;
        xTarPos.y = 0.0f;
        xTarPos.z = fTarZ;

        NFMsg.ReqAckUseSkill xData = new NFMsg.ReqAckUseSkill();
        xData.user     = NFToPB(objectID);
        xData.skill_id = System.Text.Encoding.Default.GetBytes(strKillID);
        xData.tar_pos  = xTarPos;
        xData.now_pos  = xNowPos;

        NFMsg.EffectData xEffData = new NFMsg.EffectData();
        xEffData.effect_ident = (NFToPB(nTargetID));
        xEffData.effect_value = 0;
        xEffData.effect_rlt   = 0;

        xData.effect_data.Add(xEffData);


        MemoryStream stream = new MemoryStream();

        Serializer.Serialize <NFMsg.ReqAckUseSkill>(stream, xData);

        SendMsg(objectID, NFMsg.EGameMsgID.EGMI_REQ_SKILL_OBJECTX, stream);
    }
コード例 #4
0
ファイル: NFCRecord.cs プロジェクト: joyfish/NoahGameFrame
 public NFCRecord(NFIDENTID self, string strRecordName, int nRow, NFIDataList varData)
 {
     mSelf = self;
     mnRow = nRow;
     mstrRecordName = strRecordName;
     mVarRecordType = new NFCDataList(varData);
 }
コード例 #5
0
    private void OnClassNPCEventHandler(NFIDENTID self, int nContainerID, int nGroupID, NFIObject.CLASS_EVENT_TYPE eType, string strClassName, string strConfigIndex)
    {
        if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE)
        {
            string strConfigID = NFCKernel.Instance.QueryPropertyString(self, "ConfigID");
            Vector3 vec = new Vector3();
            vec.x = NFCKernel.Instance.QueryPropertyFloat(self, "X");
            vec.y = NFCKernel.Instance.QueryPropertyFloat(self, "Y");
            vec.z = NFCKernel.Instance.QueryPropertyFloat(self, "Z");

            string strPrefabPath = "";
            if (strConfigID.Length <= 0)
            {
                strPrefabPath = NFCElementManager.Instance.QueryPropertyString("Player", "Prefab");
            }
            else
            {
                strPrefabPath = NFCElementManager.Instance.QueryPropertyString(strConfigID, "Prefab");
            }

            //CreateObject(self, strPrefabPath, vec, strClassName);
        }
        else if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_DESTROY)
        {
            //DestroyObject(self);
        }
    }
コード例 #6
0
ファイル: NFIdentID.cs プロジェクト: idleness/NoahGameFrame
        public bool Parse(string strData, out NFIDENTID id)
        {
            NFIDENTID xId = new NFIDENTID();
            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;
        }
コード例 #7
0
ファイル: NFCHeartBeat.cs プロジェクト: cbbbc/NoahGameFrame
 public NFCHeartBeat(NFIDENTID self, string strHeartBeatName, float fTime, NFIDataList valueList)
 {
     mSelf = self;
     mstrHeartBeatName = strHeartBeatName;
     mfTime = fTime;
     mfOldTime = fTime;
     mArgValueList = valueList;
 }
コード例 #8
0
    static public NFMsg.Ident NFToPB(NFCoreEx.NFIDENTID xID)
    {
        NFMsg.Ident xIdent = new NFMsg.Ident();
        xIdent.svrid = xID.nHead64;
        xIdent.index = xID.nData64;

        return(xIdent);
    }
コード例 #9
0
        static public NFCoreEx.NFIDENTID PBToNF(NFMsg.Ident xID)
        {
            NFCoreEx.NFIDENTID xIdent = new NFCoreEx.NFIDENTID();
            xIdent.nHead64 = xID.svrid;
            xIdent.nData64 = xID.index;

            return(xIdent);
        }
コード例 #10
0
        public static NFCoreEx.NFIDENTID PBToNF(NFMsg.Ident xID)
        {
            NFCoreEx.NFIDENTID xIdent = new NFCoreEx.NFIDENTID();
            xIdent.nHead64 = xID.svrid;
            xIdent.nData64 = xID.index;

            return xIdent;
        }
コード例 #11
0
ファイル: NFCKernel.cs プロジェクト: joyfish/NoahGameFrame
 public override bool AddHeartBeat(NFIDENTID self, string strHeartBeatName, NFIHeartBeat.HeartBeatEventHandler handler, float fTime, NFIDataList valueList)
 {
     NFIObject xGameObject = GetObject(self);
     if (null != xGameObject)
     {
         xGameObject.GetHeartBeatManager().AddHeartBeat(strHeartBeatName, fTime, handler, valueList);
     }
     return true;
 }
コード例 #12
0
ファイル: NFCObject.cs プロジェクト: joyfish/NoahGameFrame
 public NFCObject(NFIDENTID self, int nContainerID, int nGroupID, string strClassName, string strConfigIndex)
 {
     mSelf = self;
     mstrClassName = strClassName;
     mstrConfigIndex = strConfigIndex;
     mnContainerID = nContainerID;
     mnGroupID = nGroupID;
     Init();
 }
コード例 #13
0
    public void RequireHeartBeat(NFCoreEx.NFIDENTID objectID)
    {
        NFMsg.ReqHeartBeat xData = new NFMsg.ReqHeartBeat();

        MemoryStream stream = new MemoryStream();

        Serializer.Serialize <NFMsg.ReqHeartBeat>(stream, xData);

        SendMsg(objectID, NFMsg.EGameMsgID.EGMI_STS_HEART_BEAT, stream);
    }
コード例 #14
0
    public void RequirePickUpItem(NFCoreEx.NFIDENTID objectID, NFCoreEx.NFIDENTID nItemID)
    {
        NFMsg.ReqPickDropItem xData = new NFMsg.ReqPickDropItem();
        xData.item_guid = NFToPB(nItemID);

        MemoryStream stream = new MemoryStream();

        Serializer.Serialize <NFMsg.ReqPickDropItem>(stream, xData);

        SendMsg(objectID, NFMsg.EGameMsgID.EGMI_REQ_PICK_ITEM, stream);
    }
コード例 #15
0
    public void RequireCompeleteTask(NFCoreEx.NFIDENTID objectID, string strTaskID)
    {
        NFMsg.ReqCompeleteTask xData = new NFMsg.ReqCompeleteTask();
        xData.task_id = UnicodeEncoding.Default.GetBytes(strTaskID);

        MemoryStream stream = new MemoryStream();

        Serializer.Serialize <NFMsg.ReqCompeleteTask>(stream, xData);

        SendMsg(objectID, NFMsg.EGameMsgID.EGMI_REQ_COMPELETE_TASK, stream);
    }
コード例 #16
0
    public void RequireDelRole(NFCoreEx.NFIDENTID objectID, string strAccount, string strRoleName, int nGameID)
    {
        NFMsg.ReqDeleteRole xData = new NFMsg.ReqDeleteRole();
        xData.name    = UnicodeEncoding.Default.GetBytes(strRoleName);
        xData.account = UnicodeEncoding.Default.GetBytes(strAccount);
        xData.game_id = nGameID;

        MemoryStream stream = new MemoryStream();

        Serializer.Serialize <NFMsg.ReqDeleteRole>(stream, xData);

        SendMsg(objectID, NFMsg.EGameMsgID.EGMI_REQ_DELETE_ROLE, stream);
    }
コード例 #17
0
    public void RequireSwapScene(NFCoreEx.NFIDENTID objectID, int nTransferType, int nSceneID, int nLineIndex)
    {
        NFMsg.ReqAckSwapScene xData = new NFMsg.ReqAckSwapScene();
        xData.transfer_type = (NFMsg.ReqAckSwapScene.EGameSwapType)nTransferType;
        xData.scene_id      = nSceneID;
        xData.line_id       = nLineIndex;

        MemoryStream stream = new MemoryStream();

        Serializer.Serialize <NFMsg.ReqAckSwapScene>(stream, xData);

        SendMsg(objectID, NFMsg.EGameMsgID.EGMI_REQ_SWAP_SCENE, stream);
    }
コード例 #18
0
    public void RequireChat(NFCoreEx.NFIDENTID objectID, NFCoreEx.NFIDENTID targetID, int nType, string strData)
    {
        NFMsg.ReqAckPlayerChat xData = new NFMsg.ReqAckPlayerChat();
        xData.chat_id   = NFToPB(targetID);
        xData.chat_name = UnicodeEncoding.Default.GetBytes(xNet.strRoleName);
        xData.chat_type = (NFMsg.ReqAckPlayerChat.EGameChatType)nType;
        xData.chat_info = UnicodeEncoding.Default.GetBytes(strData);

        MemoryStream stream = new MemoryStream();

        Serializer.Serialize <NFMsg.ReqAckPlayerChat>(stream, xData);

        SendMsg(objectID, NFMsg.EGameMsgID.EGMI_REQ_CHAT, stream);
    }
コード例 #19
0
    public void RequireEnterGameServer(NFCoreEx.NFIDENTID objectID, string strAccount, string strRoleName, int nServerID)
    {
        NFMsg.ReqEnterGameServer xData = new NFMsg.ReqEnterGameServer();
        xData.name    = UnicodeEncoding.Default.GetBytes(strRoleName);
        xData.account = UnicodeEncoding.Default.GetBytes(strAccount);
        xData.game_id = nServerID;
        xData.id      = NFToPB(objectID);

        MemoryStream stream = new MemoryStream();

        Serializer.Serialize <NFMsg.ReqEnterGameServer>(stream, xData);

        SendMsg(objectID, NFMsg.EGameMsgID.EGMI_REQ_ENTER_GAME, stream);
    }
コード例 #20
0
    //有可能是他副本的NPC移动,因此增加64对象ID
    public void RequireUseSkill(NFCoreEx.NFIDENTID objectID, string strKillID, NFCoreEx.NFIDENTID nTargetID, float fNowX, float fNowZ, float fTarX, float fTarZ)
    {
        NFMsg.Position xNowPos = new NFMsg.Position();
        NFMsg.Position xTarPos = new NFMsg.Position();

        xNowPos.x = fNowX;
        xNowPos.y = 0.0f;
        xNowPos.z = fNowZ;
        xTarPos.x = fTarX;
        xTarPos.y = 0.0f;
        xTarPos.z = fTarZ;

        NFMsg.ReqAckUseSkill xData = new NFMsg.ReqAckUseSkill();
        xData.user     = NFToPB(objectID);
        xData.skill_id = System.Text.Encoding.Default.GetBytes(strKillID);
        xData.tar_pos  = xTarPos;
        xData.now_pos  = xNowPos;

        NFMsg.EffectData xEffData = new NFMsg.EffectData();
        xEffData.effect_ident = (NFToPB(nTargetID));
        xEffData.effect_value = 0;
        xEffData.effect_rlt   = 0;

        xData.effect_data.Add(xEffData);


        MemoryStream stream = new MemoryStream();

        Serializer.Serialize <NFMsg.ReqAckUseSkill>(stream, xData);

        SendMsg(objectID, NFMsg.EGameMsgID.EGMI_REQ_SKILL_OBJECTX, stream);

        /////////////////////////////////////////////
        if (NFStart.Instance.bDebugMode)
        {
            NFMsg.MsgBase xAckData = new NFMsg.MsgBase();
            xAckData.player_id = NFToPB(objectID);
            xAckData.msg_data  = stream.ToArray();

            MemoryStream xAckBody = new MemoryStream();
            Serializer.Serialize <NFMsg.MsgBase>(xAckBody, xAckData);

            MsgHead head = new MsgHead();
            head.unMsgID   = (UInt16)NFMsg.EGameMsgID.EGMI_ACK_SKILL_OBJECTX;
            head.unDataLen = (UInt32)xAckBody.Length + (UInt32)ConstDefine.NF_PACKET_HEAD_SIZE;

            xNet.mxBinMsgEvent.OnMessageEvent(head, xAckBody.ToArray());
        }
    }
コード例 #21
0
    public void RequireMoveImmune(NFCoreEx.NFIDENTID objectID, float fX, float fZ)
    {
        NFMsg.ReqAckPlayerMove xData = new NFMsg.ReqAckPlayerMove();
        xData.mover    = NFToPB(objectID);
        xData.moveType = 0;
        NFMsg.Position xTargetPos = new NFMsg.Position();
        xTargetPos.x = fX;
        xTargetPos.z = fZ;
        xData.target_pos.Add(xTargetPos);

        MemoryStream stream = new MemoryStream();

        Serializer.Serialize <NFMsg.ReqAckPlayerMove>(stream, xData);

        SendMsg(objectID, NFMsg.EGameMsgID.EGMI_REQ_MOVE_IMMUNE, stream);
    }
コード例 #22
0
ファイル: NFCKernel.cs プロジェクト: joyfish/NoahGameFrame
        void InitRecord(NFIDENTID self, string strClassName)
        {
            NFILogicClass xLogicClass = NFCLogicClassManager.Instance.GetElement(strClassName);
            NFIDataList xDataList = xLogicClass.GetRecordManager().GetRecordList();
            for (int i = 0; i < xDataList.Count(); ++i)
            {
                string strRecordyName = xDataList.StringVal(i);
                NFIRecord xRecord = xLogicClass.GetRecordManager().GetRecord(strRecordyName);

                NFIObject xObject = GetObject(self);
                NFIRecordManager xRecordManager = xObject.GetRecordManager();

                xRecordManager.AddRecord(strRecordyName, xRecord.GetRows(), xRecord.GetColsData());
            }
        }
コード例 #23
0
ファイル: NFCKernel.cs プロジェクト: joyfish/NoahGameFrame
        void InitProperty(NFIDENTID self, string strClassName)
        {
            NFILogicClass xLogicClass = NFCLogicClassManager.Instance.GetElement(strClassName);
            NFIDataList xDataList = xLogicClass.GetPropertyManager().GetPropertyList();
            for (int i = 0; i < xDataList.Count(); ++i )
            {
                string strPropertyName = xDataList.StringVal(i);
                NFIProperty xProperty = xLogicClass.GetPropertyManager().GetProperty(strPropertyName);

                NFIObject xObject = GetObject(self);
                NFIPropertyManager xPropertyManager = xObject.GetPropertyManager();

                xPropertyManager.AddProperty(strPropertyName, xProperty.GetValue());
            }
        }
コード例 #24
0
ファイル: NFIKernel.cs プロジェクト: zmyer/NoahGameFrame
 public abstract bool FindHeartBeat(NFIDENTID self, string strHeartBeatName);
コード例 #25
0
    public void OnGUI(NFIKernel kernel, int nHeight, int nWidth)
    {
        if (buttonLeft == null)
        {

            buttonLeft = GUI.skin.button;

            buttonLeft.alignment = TextAnchor.MiddleLeft;

        }

        int nElementWidth = 150;
        int nElementHeight = 20;

        GUI.color = Color.red;
        strInfo = GUI.TextField(new Rect(0, nHeight - 20, nElementWidth * 3f + 120, 20), strInfo);
        strCommand = GUI.TextField(new Rect(nElementWidth * 3f + 120, nHeight - 20, 350, 20), strCommand);
        if (GUI.Button(new Rect(nWidth - 100, nHeight - 20, 100, 20),  "cmd"))
        {

        }
        GUI.color = Color.white;

        NFIDataList objectList = kernel.GetObjectList();

        scrollPositionFirst = GUI.BeginScrollView(new Rect(0, nElementHeight, nElementWidth / 2 + 20, nHeight), scrollPositionFirst, new Rect(0, 0, nElementWidth, objectList.Count() * (nElementHeight)));

        //all object
        for (int i = 0; i < objectList.Count(); i++)
        {
            NFIDENTID ident = objectList.ObjectVal(i);

            if (GUI.Button(new Rect(0, i * nElementHeight, nElementWidth, nElementHeight), ident.nHead64.ToString()  + "_" + ident.nData64.ToString()))
            {
                xTargetIdent = ident;
                strTableName = "";
            }

        }

        GUI.EndScrollView();

        ////////////////
        if(!xTargetIdent.IsNull())
        {
            NFIObject go = kernel.GetObject(xTargetIdent);

            NFIDataList recordLlist = go.GetRecordManager().GetRecordList();
            NFIDataList propertyList = go.GetPropertyManager().GetPropertyList();

            int nAllElement = 1;
            for(int j = 0; j < recordLlist.Count(); j++)
            {
                string strRecordName = recordLlist.StringVal(j);
                if(strRecordName.Length > 0)
                {
                    nAllElement++;
                }
            }
            for(int j = 0; j < propertyList.Count(); j++)
            {
                string strPropertyName = propertyList.StringVal(j);
                if(strPropertyName.Length > 0)
                {
                    nAllElement++;
                }
            }
            //////////////////
            scrollPositionSecond = GUI.BeginScrollView(new Rect(nElementWidth / 2 + 20, nElementHeight, nElementWidth+20, nHeight/2), scrollPositionSecond, new Rect(0, 0, nElementWidth, (nAllElement+1) * (nElementHeight) + 1));

            int nElementIndex = 0;
            GUI.Button(new Rect(0, nElementIndex*nElementHeight, nElementWidth, nElementHeight), xTargetIdent.nData64.ToString());
            nElementIndex++;
            //all record
            for(int j = 0; j < recordLlist.Count(); j++)
            {
                string strRecordName = recordLlist.StringVal(j);
                if(strRecordName.Length > 0)
                {
                    if(GUI.Button(new Rect(0, nElementIndex*nElementHeight, nElementWidth, nElementHeight), "++" + strRecordName))
                    {
                        strTableName = strRecordName;
                    }

                    nElementIndex++;
                }

            }

            ///////////////////////////////
            //all property

            for (int k = 0; k < propertyList.Count(); k++)
            {
                string strPropertyValue = null;
                string strPropertyName = propertyList.StringVal(k);
                NFIProperty property = go.GetPropertyManager().GetProperty(strPropertyName);
                NFIDataList.VARIANT_TYPE eType = property.GetType();
                switch (eType)
                {
                    case NFIDataList.VARIANT_TYPE.VTYPE_DOUBLE:
                        strPropertyValue = property.QueryDouble().ToString();
                        break;
                    case NFIDataList.VARIANT_TYPE.VTYPE_FLOAT:
                        strPropertyValue = property.QueryFloat().ToString();
                        break;
                    case NFIDataList.VARIANT_TYPE.VTYPE_INT:
                        strPropertyValue = property.QueryInt().ToString();
                        break;
                    case NFIDataList.VARIANT_TYPE.VTYPE_OBJECT:
                        strPropertyValue = property.QueryObject().nData64.ToString();
                        break;
                    case NFIDataList.VARIANT_TYPE.VTYPE_STRING:
                        strPropertyValue = property.QueryString();
                        break;
                    default:
                        strPropertyValue = "?";
                        break;
                }

                if (strPropertyName.Length > 0)
                {
                    if (GUI.Button(new Rect(0, nElementIndex * nElementHeight, nElementWidth, nElementHeight), strPropertyName + ":" + strPropertyValue))
                    {
                        strTableName = "";
                        strInfo = strPropertyName + ":" + strPropertyValue;
                    }
                    nElementIndex++;
                }

            }

            GUI.EndScrollView();
            ////////////////////////

            if(strTableName.Length > 0)
            {
                NFIRecord record = go.GetRecordManager().GetRecord(strTableName);
                if(null != record)
                {
                    int nRow = record.GetRows();
                    int nCol = record.GetCols();
                    int nOffest = 30;

                    scrollPositionThird = GUI.BeginScrollView(new Rect(nElementWidth * 1.5f + 40, nElementHeight, nElementWidth * 2, nHeight/2), scrollPositionThird, new Rect(0, 0, nElementWidth * nCol + nOffest, nRow * nElementHeight + nOffest));

                    string selString = null;

                    for(int row = 0; row < nRow; row++)
                    {
                        GUI.Button(new Rect(0, row*nElementHeight+nOffest, nOffest, nElementHeight), row.ToString());//row
                        for(int col = 0; col < nCol; col++)
                        {
                            if(0 == row)
                            {
                                GUI.Button(new Rect(col * nElementWidth + nOffest, 0, nElementWidth, nElementHeight), col.ToString() + "  [" + record.GetColType(col) + "]");
                            }

                            if(record.IsUsed(row))
                            {
                                NFIDataList.VARIANT_TYPE eType = record.GetColType(col);
                                switch(eType)
                                {
                                case NFIDataList.VARIANT_TYPE.VTYPE_INT:
                                    selString = record.QueryInt(row, col).ToString();
                                    break;

                                case NFIDataList.VARIANT_TYPE.VTYPE_FLOAT:
                                    selString = record.QueryFloat(row, col).ToString();
                                    break;

                                case NFIDataList.VARIANT_TYPE.VTYPE_DOUBLE:
                                    selString = record.QueryDouble(row, col).ToString();
                                    break;

                                case NFIDataList.VARIANT_TYPE.VTYPE_STRING:
                                    selString = record.QueryString(row, col).ToString();
                                    break;

                                case NFIDataList.VARIANT_TYPE.VTYPE_OBJECT:
                                    selString = record.QueryObject(row, col).nData64.ToString();
                                    break;

                                default:
                                    selString = "UnKnowType";
                                    break;

                                }
                            }
                            else
                            {
                                selString = "NoUse";
                            }

                            if(GUI.Button(new Rect(col*nElementWidth+nOffest, row*nElementHeight+nOffest, nElementWidth, nElementHeight), selString))
                            {
                                strInfo = "Row:" + row.ToString() + " Col:" + col.ToString() + " " + selString;
                            }

                        }
                    }

                    GUI.EndScrollView();
                }
            }

        }
    }
コード例 #26
0
ファイル: NFCObject.cs プロジェクト: joyfish/NoahGameFrame
        public override bool SetRecordObject(string strRecordName, int nRow, int nCol, NFIDENTID obj)
        {
            NFIRecord record = mRecordManager.GetRecord(strRecordName);
            if (null != record)
            {
                record.SetObject(nRow, nCol, obj);
                return true;
            }

            return false;
        }
コード例 #27
0
ファイル: NFIObject.cs プロジェクト: joyfish/NoahGameFrame
 public abstract bool SetPropertyObject(string strPropertyName, NFIDENTID obj);
コード例 #28
0
        public override bool SetRecordObject(NFIDENTID self, string strRecordName, int nRow, int nCol, NFIDENTID objectValue)
        {
            if (mhtObject.ContainsKey(self))
            {
                NFIObject xGameObject = (NFIObject)mhtObject[self];
                return(xGameObject.SetRecordObject(strRecordName, nRow, nCol, objectValue));
            }

            return(false);
        }
コード例 #29
0
        public override int FindRecordRow(NFIDENTID self, string strRecordName, int nCol, NFIDENTID nValue)
        {
            if (mhtObject.ContainsKey(self))
            {
                NFIObject          xGameObject = (NFIObject)mhtObject[self];
                NFCoreEx.NFIRecord xRecord     = xGameObject.GetRecordManager().GetRecord(strRecordName);
                if (null != xRecord)
                {
                    return(xRecord.FindObject(nCol, nValue));
                }
            }

            return(-1);
        }
コード例 #30
0
ファイル: NFCKernel.cs プロジェクト: joyfish/NoahGameFrame
        public override NFIObject CreateObject(NFIDENTID self, int nContainerID, int nGroupID, string strClassName, string strConfigIndex, NFIDataList arg)
        {
            if (!mhtObject.ContainsKey(self))
            {
                NFIObject xNewObject = new NFCObject(self, nContainerID, nGroupID, strClassName, strConfigIndex);
                mhtObject.Add(self, xNewObject);

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

                NFCDataList varConfigClass = new NFCDataList();
                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);
                        NFIDataList.VARIANT_TYPE eType = arg.GetType(i + 1);
                        switch (eType)
                        {
                            case NFIDataList.VARIANT_TYPE.VTYPE_INT:
                                {
                                    NFIDataList xDataList = new NFCDataList();
                                    xDataList.AddInt(arg.IntVal(i+1));
                                    xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList);
                                }
                                break;
                            case NFIDataList.VARIANT_TYPE.VTYPE_FLOAT:
                                {
                                    NFIDataList xDataList = new NFCDataList();
                                    xDataList.AddFloat(arg.FloatVal(i + 1));
                                    xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList);
                                }
                                break;
                            case NFIDataList.VARIANT_TYPE.VTYPE_DOUBLE:
                                {
                                    NFIDataList xDataList = new NFCDataList();
                                    xDataList.AddDouble(arg.DoubleVal(i + 1));
                                    xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList);
                                }
                                break;
                            case NFIDataList.VARIANT_TYPE.VTYPE_STRING:
                                {
                                    NFIDataList xDataList = new NFCDataList();
                                    xDataList.AddString(arg.StringVal(i + 1));
                                    xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList);
                                }
                                break;
                            case NFIDataList.VARIANT_TYPE.VTYPE_OBJECT:
                                {
                                    NFIDataList xDataList = new NFCDataList();
                                    xDataList.AddObject(arg.ObjectVal(i + 1));
                                    xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList);
                                }
                                break;
                            default:
                                break;
                        }
                    }
                }

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

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

            return null;
        }
コード例 #31
0
ファイル: NFIRecord.cs プロジェクト: cbbbc/NoahGameFrame
 public abstract bool SetObject(int nRow, int nCol, NFIDENTID value);
コード例 #32
0
ファイル: NFCObject.cs プロジェクト: joyfish/NoahGameFrame
        public override bool SetPropertyObject(string strPropertyName, NFIDENTID obj)
        {
            NFIProperty property = mPropertyManager.GetProperty(strPropertyName);
            if (null == property)
            {
                NFIDataList valueList = new NFCDataList();
                valueList.AddObject(new NFIDENTID());
                property = mPropertyManager.AddProperty(strPropertyName, valueList);
            }

            property.SetObject(obj);
            return true;
        }
コード例 #33
0
ファイル: MainEx.cs プロジェクト: joyfish/NoahGameFrame
        public static void Main()
        {
            NFIKernel kernel = new NFCKernel();

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

            NFIDataList var = new NFCDataList();

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

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

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

            NFIDENTID ident = new NFIDENTID(0, 1);
            NFIObject gameObject = kernel.CreateObject(ident, 0, 0, "", "", new NFCDataList());

            NFIDataList valueProperty = new NFCDataList();
            valueProperty.AddInt(112221);
            gameObject.GetPropertyManager().AddProperty("111", valueProperty);
            Console.WriteLine(gameObject.QueryPropertyInt("111"));

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

            NFIDataList valueRecord = new NFCDataList();
            valueRecord.AddInt(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("***************PropertyNFEvent*******************");

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

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

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

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

            kernel.RegisterClassCallBack("CLASSAAAAA", OnClassHandler);
            kernel.CreateObject(new NFIDENTID(0, 2), 0, 0, "CLASSAAAAA", "CONFIGINDEX", new NFCDataList());
            kernel.DestroyObject(new NFIDENTID(0, 2));

            Console.WriteLine(" ");
            Console.WriteLine("***************NFHeartBeat*******************");
            kernel.AddHeartBeat(new NFIDENTID(0, 1), "TestHeartBeat", HeartBeatEventHandler, 5.0f, new NFCDataList());

            while (true)
            {
                System.Threading.Thread.Sleep(1000);
                kernel.UpDate(1.0f);
            }
        }
コード例 #34
0
ファイル: NFIObject.cs プロジェクト: joyfish/NoahGameFrame
 public abstract bool SetRecordObject(string strRecordName, int nRow, int nCol, NFIDENTID obj);
コード例 #35
0
ファイル: MainEx.cs プロジェクト: joyfish/NoahGameFrame
 static void OnRecordEventHandler(NFIDENTID self, string strRecordName, NFIRecord.eRecordOptype eType, int nRow, int nCol, NFIDataList oldVar, NFIDataList newVar)
 {
     Console.Write(self);
     Console.Write(" ");
     Console.Write(strRecordName);
     Console.Write(" ");
     Console.Write(eType.ToString());
     Console.Write(" ");
     Console.Write(nRow);
     Console.Write(" ");
     Console.Write(nCol);
     Console.Write(" ");
     Console.Write(oldVar.IntVal(0));
     Console.Write(" ");
     Console.Write(newVar.IntVal(0));
     Console.WriteLine(" ");
 }
コード例 #36
0
ファイル: NFIRecord.cs プロジェクト: cbbbc/NoahGameFrame
 public abstract int FindObject(int nCol, NFIDENTID value);
コード例 #37
0
        public override bool AddObject(NFIDENTID value)
        {
            Var_Data data = new Var_Data();
            data.nType = VARIANT_TYPE.VTYPE_OBJECT;
            data.mData = value;

            return AddDataObject(ref data);
        }
コード例 #38
0
ファイル: MainEx.cs プロジェクト: joyfish/NoahGameFrame
 static void OnClassHandler(NFIDENTID self, int nContainerID, int nGroupID, NFIObject.CLASS_EVENT_TYPE eType, string strClassName, string strConfigIndex)
 {
     Console.Write(self);
     Console.Write(" ");
     Console.Write(eType.ToString());
     Console.Write(" ");
     Console.Write(strClassName);
     Console.Write(" ");
     Console.Write(strConfigIndex);
     Console.WriteLine(" ");
 }
コード例 #39
0
        public override bool SetPropertyObject(NFIDENTID self, string strPropertyName, NFIDENTID objectValue)
        {
            if (mhtObject.ContainsKey(self))
            {
                NFIObject xGameObject = (NFIObject)mhtObject[self];
                return(xGameObject.SetPropertyObject(strPropertyName, objectValue));
            }

            return(false);
        }
コード例 #40
0
ファイル: MainEx.cs プロジェクト: joyfish/NoahGameFrame
 static void OnPropertydHandler(NFIDENTID self, string strProperty, NFIDataList oldVar, NFIDataList newVar)
 {
     Console.Write(self);
     Console.Write(" ");
     Console.Write(strProperty);
     Console.Write(" ");
     Console.Write(oldVar.IntVal(0));
     Console.Write(" ");
     Console.Write(newVar.IntVal(0));
     Console.WriteLine(" ");
 }
コード例 #41
0
        public override NFIObject CreateObject(NFIDENTID self, int nContainerID, int nGroupID, string strClassName, string strConfigIndex, NFIDataList arg)
        {
            if (!mhtObject.ContainsKey(self))
            {
                NFIObject xNewObject = new NFCObject(self, nContainerID, nGroupID, strClassName, strConfigIndex);
                mhtObject.Add(self, xNewObject);

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

                NFCDataList varConfigClass = new NFCDataList();
                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);
                        NFIDataList.VARIANT_TYPE eType = arg.GetType(i + 1);
                        switch (eType)
                        {
                        case NFIDataList.VARIANT_TYPE.VTYPE_INT:
                        {
                            NFIDataList xDataList = new NFCDataList();
                            xDataList.AddInt(arg.IntVal(i + 1));
                            xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList);
                        }
                        break;

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

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

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

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

                        default:
                            break;
                        }
                    }
                }

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

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

            return(null);
        }
コード例 #42
0
ファイル: MainEx.cs プロジェクト: joyfish/NoahGameFrame
 static void HeartBeatEventHandler(NFIDENTID self, string strHeartBeat, float fTime, NFIDataList valueList)
 {
     Console.Write(self);
     Console.Write(" ");
     Console.Write(strHeartBeat);
     Console.Write(" ");
     Console.Write(fTime.ToString());
     Console.WriteLine(" ");
 }
コード例 #43
0
ファイル: NFCKernel.cs プロジェクト: joyfish/NoahGameFrame
        public override bool SetRecordString(NFIDENTID self, string strRecordName, int nRow, int nCol, string strValue)
        {
            if (mhtObject.ContainsKey(self))
            {
                NFIObject xGameObject = (NFIObject)mhtObject[self];
                return xGameObject.SetRecordString(strRecordName, nRow, nCol, strValue);
            }

            return false;
        }
コード例 #44
0
        private void ADD_ROW(NFIDENTID self, string strRecordName, NFMsg.RecordAddRowStruct xAddStruct)
        {
            NFIObject go = NFCKernel.Instance.GetObject(self);
            NFIRecordManager xRecordManager = go.GetRecordManager();

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

            for (int k = 0; k < xAddStruct.record_int_list.Count; ++k)
            {
                NFMsg.RecordInt addIntStruct = (NFMsg.RecordInt)xAddStruct.record_int_list[k];

                if (addIntStruct.col >= 0)
                {
                    recordVecDesc[addIntStruct.col] = NFIDataList.VARIANT_TYPE.VTYPE_INT;
                    recordVecData[addIntStruct.col] = addIntStruct.data;
                }
            }

            for (int k = 0; k < xAddStruct.record_float_list.Count; ++k)
            {
                NFMsg.RecordFloat addFloatStruct = (NFMsg.RecordFloat)xAddStruct.record_float_list[k];

                if (addFloatStruct.col >= 0)
                {
                    recordVecDesc[addFloatStruct.col] = NFIDataList.VARIANT_TYPE.VTYPE_FLOAT;
                    recordVecData[addFloatStruct.col] = addFloatStruct.data;

                }
            }

            for (int k = 0; k < xAddStruct.record_string_list.Count; ++k)
            {
                NFMsg.RecordString addStringStruct = (NFMsg.RecordString)xAddStruct.record_string_list[k];

                if (addStringStruct.col >= 0)
                {
                    recordVecDesc[addStringStruct.col] = NFIDataList.VARIANT_TYPE.VTYPE_STRING;
                    recordVecData[addStringStruct.col] = System.Text.Encoding.Default.GetString(addStringStruct.data);

                }
            }

            for (int k = 0; k < xAddStruct.record_object_list.Count; ++k)
            {
                NFMsg.RecordObject addObjectStruct = (NFMsg.RecordObject)xAddStruct.record_object_list[k];

                if (addObjectStruct.col >= 0)
                {
                    recordVecDesc[addObjectStruct.col] = NFIDataList.VARIANT_TYPE.VTYPE_OBJECT;
                    recordVecData[addObjectStruct.col] = PBToNF(addObjectStruct.data);

                }
            }

            NFIDataList varListDesc = new NFCDataList();
            NFIDataList varListData = new NFCDataList();
            for (int m = 0; m < recordVecDesc.Count; m++)
            {
                if (recordVecDesc.ContainsKey(m) && recordVecData.ContainsKey(m))
                {
                    NFIDataList.VARIANT_TYPE nType = (NFIDataList.VARIANT_TYPE)recordVecDesc[m];
                    switch (nType)
                    {
                        case NFIDataList.VARIANT_TYPE.VTYPE_INT:
                            {
                                varListDesc.AddInt(0);
                                varListData.AddInt((Int64)recordVecData[m]);
                            }

                            break;
                        case NFIDataList.VARIANT_TYPE.VTYPE_FLOAT:
                            {
                                varListDesc.AddFloat(0.0f);
                                varListData.AddFloat((float)recordVecData[m]);
                            }
                            break;
                        case NFIDataList.VARIANT_TYPE.VTYPE_STRING:
                            {
                                varListDesc.AddString("");
                                varListData.AddString((string)recordVecData[m]);
                            }
                            break;
                        case NFIDataList.VARIANT_TYPE.VTYPE_OBJECT:
                            {
                                varListDesc.AddObject(new NFIDENTID());
                                varListData.AddObject((NFIDENTID)recordVecData[m]);
                            }
                            break;
                        default:
                            break;

                    }
                }
                else
                {
                    //����
                    //Debug.LogException(i);
                }
            }

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

            xRecord.AddRow(xAddStruct.row, varListData);
        }
コード例 #45
0
    public void RequireEnterGameServer(NFCoreEx.NFIDENTID objectID, string strAccount, string strRoleName, int nServerID)
    {
        NFMsg.ReqEnterGameServer xData = new NFMsg.ReqEnterGameServer();
        xData.name    = UnicodeEncoding.Default.GetBytes(strRoleName);
        xData.account = UnicodeEncoding.Default.GetBytes(strAccount);
        xData.game_id = nServerID;
        xData.id      = NFToPB(objectID);

        MemoryStream stream = new MemoryStream();

        Serializer.Serialize <NFMsg.ReqEnterGameServer>(stream, xData);

        SendMsg(objectID, NFMsg.EGameMsgID.EGMI_REQ_ENTER_GAME, stream);

        if (NFStart.Instance.bDebugMode)
        {
            //EGMI_ACK_OBJECT_ENTRY
            //property
            //EGMI_ACK_SWAP_SCENE
            //EGMI_ACK_OBJECT_ENTRY
            //property
            float      fX       = 0.0f;
            float      fY       = 0.0f;
            float      fZ       = 0.0f;
            NFIElement xElement = NFCElementManager.Instance.GetElement("1");
            if (null != xElement)
            {
                string   strRelivePos = xElement.QueryString("RelivePos");
                string[] sArray       = strRelivePos.Split(';');
                if (sArray.Length > 0)
                {
                    sArray = sArray[0].Split(',');
                }

                if (sArray.Length == 3)
                {
                    fX = float.Parse(sArray[0]);
                    fY = float.Parse(sArray[1]);
                    fZ = float.Parse(sArray[2]);
                }
            }
            /////////////////////////////////////////////
            //mainplayer
            NFMsg.AckPlayerEntryList xAckMainBodyData = new NFMsg.AckPlayerEntryList();
            NFMsg.PlayerEntryInfo    xInfo            = new NFMsg.PlayerEntryInfo();
            NFMsg.Ident xID = new NFMsg.Ident();
            xInfo.object_guid  = xID;
            xInfo.x            = fX;
            xInfo.y            = fY;
            xInfo.z            = fZ;
            xInfo.career_type  = 1;
            xInfo.player_state = 1;
            xInfo.config_id    = UnicodeEncoding.Default.GetBytes("");
            xInfo.scene_id     = 1;
            xInfo.class_id     = UnicodeEncoding.Default.GetBytes("Player");

            xAckMainBodyData.object_list.Add(xInfo);

            MemoryStream xAckMianPlayerBodyStream = new MemoryStream();
            Serializer.Serialize <NFMsg.AckPlayerEntryList>(xAckMianPlayerBodyStream, xAckMainBodyData);

            NFMsg.MsgBase xAckMianPlayerData = new NFMsg.MsgBase();
            xAckMianPlayerData.player_id = xID;
            xAckMianPlayerData.msg_data  = xAckMianPlayerBodyStream.ToArray();

            MemoryStream xAckAllStream = new MemoryStream();
            Serializer.Serialize <NFMsg.MsgBase>(xAckAllStream, xAckMianPlayerData);

            MsgHead head = new MsgHead();
            head.unMsgID   = (UInt16)NFMsg.EGameMsgID.EGMI_ACK_OBJECT_ENTRY;
            head.unDataLen = (UInt32)xAckAllStream.Length + (UInt32)ConstDefine.NF_PACKET_HEAD_SIZE;

            xNet.mxBinMsgEvent.OnMessageEvent(head, xAckAllStream.ToArray());
            /////////////////////////////////////////////
            //property

            NFMsg.ObjectPropertyInt propertyData = new NFMsg.ObjectPropertyInt();

            PropertyInt xPropertyInt = new PropertyInt();
            xPropertyInt.property_name = UnicodeEncoding.Default.GetBytes("MOVE_SPEED");
            xPropertyInt.data          = 50000;
            propertyData.property_list.Add(xPropertyInt);
            propertyData.player_id = xID;

            MemoryStream xAckPropertyIntStream = new MemoryStream();
            Serializer.Serialize <NFMsg.ObjectPropertyInt>(xAckPropertyIntStream, propertyData);

            NFMsg.MsgBase xPropertyIntMsg = new NFMsg.MsgBase();
            xPropertyIntMsg.player_id = xID;
            xPropertyIntMsg.msg_data  = xAckPropertyIntStream.ToArray();

            MemoryStream xAckPropertyIntAllStream = new MemoryStream();
            Serializer.Serialize <NFMsg.MsgBase>(xAckPropertyIntAllStream, xPropertyIntMsg);

            MsgHead xAckPropertyhead = new MsgHead();
            xAckPropertyhead.unMsgID   = (UInt16)NFMsg.EGameMsgID.EGMI_ACK_PROPERTY_INT;
            xAckPropertyhead.unDataLen = (UInt32)xAckPropertyIntAllStream.Length + (UInt32)ConstDefine.NF_PACKET_HEAD_SIZE;

            xNet.mxBinMsgEvent.OnMessageEvent(xAckPropertyhead, xAckPropertyIntAllStream.ToArray());

            /////////////////////////////////////////////
            xNet.mPlayerState = NFNet.PLAYER_STATE.E_PLAYER_GAMEING;
            //NFCRenderInterface.Instance.LoadScene(1, fX, fY, fZ);
            /////////////////////////////////////////////

            //npc
            NFMsg.AckPlayerEntryList xAckNPCBodyData = new NFMsg.AckPlayerEntryList();
            for (int i = 0; i < 5; ++i)
            {
                NFMsg.PlayerEntryInfo xNPCInfo = new NFMsg.PlayerEntryInfo();

                NFMsg.Ident xNPCID = new NFMsg.Ident();
                xNPCID.index          = i + 10000;
                xNPCInfo.object_guid  = xNPCID;
                xNPCInfo.x            = fX + i;
                xNPCInfo.y            = fY;
                xNPCInfo.z            = fZ + i;
                xNPCInfo.career_type  = 1;
                xNPCInfo.player_state = 1;
                xNPCInfo.config_id    = UnicodeEncoding.Default.GetBytes("");
                xNPCInfo.scene_id     = 1;
                xNPCInfo.class_id     = UnicodeEncoding.Default.GetBytes("Player");

                xAckNPCBodyData.object_list.Add(xNPCInfo);
            }

            MemoryStream xAckNPCBodyStream = new MemoryStream();
            Serializer.Serialize <NFMsg.AckPlayerEntryList>(xAckNPCBodyStream, xAckNPCBodyData);

            NFMsg.MsgBase xAckNPCrData = new NFMsg.MsgBase();
            xAckNPCrData.player_id = xID;
            xAckNPCrData.msg_data  = xAckNPCBodyStream.ToArray();

            MemoryStream xAckAllNPCStream = new MemoryStream();
            Serializer.Serialize <NFMsg.MsgBase>(xAckAllNPCStream, xAckNPCrData);

            MsgHead xNPCHead = new MsgHead();
            xNPCHead.unMsgID   = (UInt16)NFMsg.EGameMsgID.EGMI_ACK_OBJECT_ENTRY;
            xNPCHead.unDataLen = (UInt32)xAckAllNPCStream.Length + (UInt32)ConstDefine.NF_PACKET_HEAD_SIZE;

            xNet.mxBinMsgEvent.OnMessageEvent(xNPCHead, xAckAllNPCStream.ToArray());
            //////////////////////////////////////////////
        }
    }
コード例 #46
0
        public override bool SetObject(int index, NFIDENTID value)
        {
            Var_Data data = GetDataObject(index);
            if (data != null && data.nType == VARIANT_TYPE.VTYPE_OBJECT)
            {
                data.mData = value;

                return true;
            }

            return false;
        }
コード例 #47
0
ファイル: NFCKernel.cs プロジェクト: joyfish/NoahGameFrame
 public override bool RemoveHeartBeat(NFIDENTID self, string strHeartBeatName)
 {
     return true;
 }
コード例 #48
0
ファイル: NFCRecord.cs プロジェクト: joyfish/NoahGameFrame
        public override int FindObject(int nCol, NFIDENTID value)
        {
            foreach (int i in mhtRecordVec.Keys)
            {
                NFIDataList valueList = (NFIDataList)mhtRecordVec[i];
                if (valueList.ObjectVal(nCol) == value)
                {
                    return i;
                }
            }

            return -1;
        }
コード例 #49
0
ファイル: NFCKernel.cs プロジェクト: joyfish/NoahGameFrame
        public override bool SetPropertyString(NFIDENTID self, string strPropertyName, string strValue)
        {
            if (mhtObject.ContainsKey(self))
            {
                NFIObject xGameObject = (NFIObject)mhtObject[self];
                return xGameObject.SetPropertyString(strPropertyName, strValue);
            }

            return false;
        }
コード例 #50
0
ファイル: NFCRecord.cs プロジェクト: joyfish/NoahGameFrame
        public override bool SetObject(int nRow, int nCol, NFIDENTID value)
        {
            if(nRow >= 0 && nRow < mnRow)
            {
                if (!mhtRecordVec.ContainsKey(nRow))
                {
                    AddRow(nRow);
                }
                NFIDataList valueList = (NFIDataList)mhtRecordVec[nRow];
                if (valueList.GetType(nCol) == NFIDataList.VARIANT_TYPE.VTYPE_OBJECT)
                {
                    if (valueList.ObjectVal(nCol) != value)
                    {
                        NFCDataList oldValue = new NFCDataList();
                        oldValue.AddObject(valueList.ObjectVal(nCol));

                        valueList.SetObject(nCol, value);

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

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

                return true;
            }

            return false;
        }
コード例 #51
0
 public override bool RemoveHeartBeat(NFIDENTID self, string strHeartBeatName)
 {
     return(true);
 }