コード例 #1
0
 public static void NPC_Action(NPC npc, User user)
 {
     //user.ToChatMessage(npc.function + "를 선택", ChatType.System);
     if (npc.function == "우편함 열기")
     {
         PostSystem.GetPage(user, 1);
     }
     if (npc.function == "키워드 알림 설정")
     {
         KeywordSystem.GetList(user);
     }
 }
コード例 #2
0
        private static void Server_Receive(ESocket socket, Newtonsoft.Json.Linq.JObject Message)
        {
            switch ((int)Message["type"])
            {
            case NetworkProtocol.Login:
                Function.Login(socket, (string)Message["id"], (string)Message["password"]);
                break;

            case NetworkProtocol.EnterWorld:
                User.Items[socket].Start();
                break;

            case NetworkProtocol.Move:
                User.Items[socket].Move(new Vector4((float)Message["x"], (float)Message["y"], (float)Message["z"], (float)Message["q"]));
                break;

            case NetworkProtocol.Chat:
                User.Items[socket].ChatMessage((string)Message["message"], ChatType.Normal);
                break;

            case NetworkProtocol.Action:
                Function.NPC_Action((NPC)GameObject.Items[(int)Message["no"]], User.Items[socket]);
                break;

            case NetworkProtocol.Post_Open:
                PostSystem.GetPage(User.Items[socket], (int)Message["page"]);
                break;

            case NetworkProtocol.Post_Detail:
                PostSystem.GetItem(User.Items[socket], (int)Message["no"]);
                break;

            case NetworkProtocol.NewStudy:
                StudySystem.NewStudy(User.Items[socket], Message);
                break;

            case NetworkProtocol.Keyword_Remove:
                KeywordSystem.RemoveItem(User.Items[socket], (string)Message["keyword"]);
                break;

            case NetworkProtocol.Keyword_Add:
                KeywordSystem.AddItem(User.Items[socket], (string)Message["keyword"]);
                break;

            case NetworkProtocol.Inventory_Remove:
                User.Items[socket].RemoveItem((int)Message["no"]);
                break;

            case NetworkProtocol.File_Download:
                User.Items[socket].DownloadItem((int)Message["no"], (string)Message["path"]);
                break;
            }
        }
コード例 #3
0
ファイル: NPC_Action.cs プロジェクト: banksemi/Gachon-Village
 /// <summary>
 /// 해당 NPC가 유저에게 상호작용의 결과를 반환합니다.
 /// </summary>
 /// <param name="npc"></param>
 /// <param name="user"></param>
 public static void NPC_Action(NPC npc, User user)
 {
     //user.ToChatMessage(npc.function + "를 선택", ChatType.System);
     if (npc.function == "우편함 열기")
     {
         // 해당 유저에게 우편함 첫번째 페이지 전송
         PostSystem.GetPage(user, 1);
     }
     if (npc.function == "키워드 알림 설정")
     {
         // 해당 유저에게 모든 키워드 목록 전송
         KeywordSystem.GetList(user);
     }
     if (npc.function == "그룹 상호작용")
     {
         // 해당 유저에게 OpenMenu 실행
         Study StudyGroup = (Study)npc;
         StudyGroup.OpenMenu(user);
     }
 }
コード例 #4
0
ファイル: Program.cs プロジェクト: banksemi/Gachon-Village
        private static void Server_Receive(ESocket socket, JObject Message)
        {
            if ((int)Message["type"] >= 1000)
            {
                switch ((int)Message["type"])
                {
                case AndroidProtocol.TestMessage:
                    Console.WriteLine("안드로이드 테스트 메세지 : " + (string)Message["message"]);
                    break;

                case AndroidProtocol.Login:
                    Function.Login(socket, (string)Message["id"], (string)Message["password"], false);
                    break;

                case AndroidProtocol.GroupList:
                    AndroidFunction.SendTakesList(socket);
                    return;

                case AndroidProtocol.KeywordList:
                    AndroidFunction.KeywordList(socket);
                    break;

                case AndroidProtocol.KeywordAdd:
                    AndroidFunction.NewKeyword(socket, (string)Message["keyword"]);
                    break;

                case AndroidProtocol.PostList:
                    if (Message["no"] != null)
                    {
                        AndroidFunction.GetPostList(socket, (int)Message["no"]);
                    }
                    break;

                case AndroidProtocol.Info:
                    AndroidFunction.ReturnInfo(socket);
                    break;
                }
            }
            else
            {
                switch ((int)Message["type"])
                {
                case NetworkProtocol.Login:
                    Function.Login(socket, (string)Message["id"], (string)Message["password"], true);
                    break;

                case NetworkProtocol.EnterWorld:
                    User.Items[socket].Start();
                    break;

                case NetworkProtocol.Move:
                    User.Items[socket].Move(new Vector4((float)Message["x"], (float)Message["y"], (float)Message["z"], (float)Message["q"]));
                    break;

                case NetworkProtocol.Chat:
                    User.Items[socket].ChatMessage((string)Message["message"], ChatType.Normal);
                    break;

                case NetworkProtocol.Action:
                    Function.NPC_Action((NPC)GameObject.Items[(int)Message["no"]], User.Items[socket]);
                    break;

                case NetworkProtocol.Post_Open:
                    PostSystem.GetPage(User.Items[socket], (int)Message["page"]);
                    break;

                case NetworkProtocol.Post_Detail:
                    PostSystem.GetItem(User.Items[socket], (int)Message["no"]);
                    break;

                case NetworkProtocol.NewStudy:
                    StudySystem.NewStudy(User.Items[socket], Message);
                    break;

                case NetworkProtocol.Keyword_Remove:
                    KeywordSystem.RemoveItem(User.Items[socket], (string)Message["keyword"]);
                    break;

                case NetworkProtocol.Keyword_Add:
                    KeywordSystem.AddItem(User.Items[socket], (string)Message["keyword"]);
                    break;

                case NetworkProtocol.Inventory_Remove:
                    User.Items[socket].RemoveItem((int)Message["no"]);
                    break;

                case NetworkProtocol.File_Download:
                    User.Items[socket].DownloadItem((int)Message["no"], (string)Message["path"], (bool)Message["open"]);
                    break;

                case NetworkProtocol.Study_SignUp:
                    Study.Items[(string)Message["name"]].SignUpRequest(User.Items[socket]);
                    break;

                case NetworkProtocol.Study_UI:
                    Study.Items[(string)Message["name"]].OpenMenu(User.Items[socket], (string)Message["tab"]);
                    break;

                case NetworkProtocol.Study_Member_Request:
                    Study.Items[(string)Message["name"]].Member_Modify(User.Items[socket], Message);
                    break;

                case NetworkProtocol.Study_SaveChatting:
                    Study.Items[(string)Message["name"]].SaveChatting(User.Items[socket]);
                    break;

                case NetworkProtocol.Study_FileUpload:
                    Study.Items[(string)Message["group_name"]].FileUpload(User.Items[socket], (int)Message["no"]);
                    break;

                case NetworkProtocol.Study_FileDownload:
                    Study.Items[(string)Message["group_name"]].FileDownload(User.Items[socket], (int)Message["no"]);
                    break;

                case NetworkProtocol.SendPost:
                    NetworkMessageList.SendMessageResult(socket, PostSystem.SendPost(socket, Message));
                    break;

                case NetworkProtocol.GetFileInPost:
                    PostSystem.GetFile(socket, Message);
                    break;
                }
            }
        }