예제 #1
0
        /// <summary>
        /// Send a voice message.
        /// </summary>
        /// <param name="openId">User's open id from WeChat.</param>
        /// <param name="messageMenu">Message menu that need to be sent.</param>
        /// <param name="timeout">Send message operation timeout.</param>
        /// <param name="customerServiceAccount">Customer service account open id.</param>
        /// <returns>Standard result of calling WeChat message API.</returns>
        public async Task <WeChatJsonResult> SendMessageMenuAsync(string openId, MessageMenu messageMenu, int timeout = 10000, string customerServiceAccount = "")
        {
            object data;

            if (string.IsNullOrWhiteSpace(customerServiceAccount))
            {
                data = new
                {
                    agentid = _settings.AgentId,
                    touser  = openId,
                    msgtype = ResponseMessageTypes.MessageMenu,
                    msgmenu = messageMenu,
                };
            }
            else
            {
                data = new
                {
                    agentid       = _settings.AgentId,
                    touser        = openId,
                    msgtype       = ResponseMessageTypes.MessageMenu,
                    msgmenu       = messageMenu,
                    customservice = new
                    {
                        kf_account = customerServiceAccount,
                    },
                };
            }

            return(await SendMessageToUser(data, timeout).ConfigureAwait(false));
        }
예제 #2
0
        public void joinTopic()
        {
            //Receive the topic chosen and the user
            MessageMenu choice = (MessageMenu)Net.receiveMessage(comm.GetStream());
            MessageUser mu     = (MessageUser)Net.receiveMessage(comm.GetStream());

            //Get the topic
            Topic topic = topics[choice.MessageSend - 1];


            //Add the client to the topic
            bool searchClient = false;

            foreach (User u in topic.Chatters)
            {
                if (u.Id_user.Equals(mu.Id_user))
                {
                    searchClient = true;
                }
            }

            if (searchClient == false)
            {
                topic.Chatters.Add(mu.getUser());
            }

            Net.sendMessage(comm.GetStream(), new MessageTopic(topic));

            //Create the thread to display messages
            Thread displayTopicThread = new Thread(new ParameterizedThreadStart(displayTopic));

            displayTopicThread.Start(topic);
        }
예제 #3
0
        public void launchApp()
        {
            //Get the choice on the menu from the user

            MessageMenu choice = (MessageMenu)Net.receiveMessage(comm.GetStream());

            if (choice.MessageSend == 1)
            {
                //Launch the thread to create a new user
                MessageMenu mn = new MessageMenu(1);
                Net.sendMessage(comm.GetStream(), mn);
                createUser();
            }
            else if (choice.MessageSend == 2)
            {
                //Launch the connection thread
                MessageMenu mn = new MessageMenu(2);
                Net.sendMessage(comm.GetStream(), mn);
                doConnection();
            }
            else if (choice.MessageSend == 3)
            {
                //Exit the app
                MessageMenu mn = new MessageMenu(3);
                Net.sendMessage(comm.GetStream(), mn);
            }
        }
예제 #4
0
 public CheckPaymentBasis(DungeonMerchant param)
     : base()
 {
     Merchant = param;
     Payment = false;
     Message = new MessageMenu(param.Controller);
 }
예제 #5
0
 public static PlayTalkText createSequenceTextFromCharacterTalkText(CharacterTalkText talktext,MessageMenu displaymenu)
 {
     StringBuilder stb = new StringBuilder();
     foreach(KeyValuePair<int,string> pair in talktext.SequenceTexts)
     {
         stb.Append(pair.Value);
     }
     return new PlayTalkText(stb.ToString(),displaymenu);
 }
예제 #6
0
파일: Game.cs 프로젝트: llenroc/LudumDare36
    private void SetupProperties()
    {
        Instance = this;

        if (!MessageMenu)
        {
            MessageMenu = FindObjectOfType <MessageMenu>();
        }

        if (!Controller)
        {
            Controller = FindObjectOfType <MenuController>();
        }

        if (!Music)
        {
            Music = FindObjectOfType <MusicController>();
        }

        if (!World)
        {
            World = FindObjectOfType <WorldController>();
        }

        if (!MiniMap)
        {
            MiniMap = FindObjectOfType <MiniMapController>();
        }

        if (!Player)
        {
            Player = FindObjectOfType <PlayerController>();
        }

        if (!Score)
        {
            Score = FindObjectOfType <ScoreManager>();
        }

        if (Score)
        {
            Score.Game = this;
        }

        if (Music)
        {
            Music.Reset();
        }

        GameModeManager.Instance.Game = this;
    }
예제 #7
0
        public void joinTopic()
        {
            MessageMenu mn = new MessageMenu(0);
            MessageUser mu = new MessageUser(user.Id_user, user.Login, user.Password, false);

            Console.WriteLine("\t\tChoose to join / update a topic : ");

            //Send the choice and the user
            mn.MessageSend = Int32.Parse(Console.ReadLine());
            Net.sendMessage(comm.GetStream(), mn);
            Net.sendMessage(comm.GetStream(), mu);

            displayTopic();
        }
예제 #8
0
        public void application()
        {
            //Create a message for the selection of the menu
            MessageMenu mn        = new MessageMenu(0);
            bool        connected = false;

            do
            {
                Console.WriteLine("\t\t*********************************************");
                Console.WriteLine("\t\t********** WELCOME TO THE CHAT APP **********");
                Console.WriteLine("\t\t*********************************************");
                Console.WriteLine("\t\t1. Don't have an account ? Sign up !");
                Console.WriteLine("\t\t2. Log in");
                Console.WriteLine("\t\t3. Close app");

                //Read the user's choice and send it

                mn = new MessageMenu(0);


                mn.MessageSend = Int32.Parse(Console.ReadLine());
                Net.sendMessage(comm.GetStream(), mn);

                //Take the result of the choice print the next steps (create user form or topics form)
                mn = (MessageMenu)Net.receiveMessage(comm.GetStream());

                if (mn.MessageSend == 1)
                {
                    createClient();
                }
                else if (mn.MessageSend == 2)
                {
                    logClient();
                    connected = true;
                }
                else if (mn.MessageSend == 3)
                {
                    comm.Close();
                    System.Environment.Exit(1);
                }
            } while (connected != true);

            if (connected == true)
            {
                Console.WriteLine("You are logged in as " + user.Login);
                connectedActions();
            }
        }
 public static LinkedList<TalkActionBasis> createPlayMessage(MyCharacterController owner, params string[] messages)
 {
     LinkedList<TalkActionBasis> ret = new LinkedList<TalkActionBasis>();
     var menu = new MessageMenu(owner);
     menu.setMessage("");
     foreach (string str in messages) {
         ret.AddLast(new PlayTalkText(str,menu));
     }
     var open = new OpenMenu(menu, false);
     open.IsOperationExit = delegate { return open.Menu.Opend; };
     var close = new CloseMenu(menu);
     close.PlayCloseSound = false;
     ret.AddFirst(open);
     ret.AddLast(close);
     return ret;
 }
예제 #10
0
        public void joinUser()
        {
            MessageMenu mn = new MessageMenu(0);
            MessageUser mu = new MessageUser(user.Id_user, user.Login, user.Password, false);

            Console.WriteLine("\t\tChoose to join a user : ");

            //Send the choice and the user
            mn.MessageSend = Int32.Parse(Console.ReadLine());

            //Send the user that we want to send to
            Net.sendMessage(comm.GetStream(), mn);

            //Send our user
            Net.sendMessage(comm.GetStream(), mu);

            displayPrivateChat();
        }
예제 #11
0
        public void connectedActions()
        {
            //Get the choice on the menu from the user
            MessageMenu choice = (MessageMenu)Net.receiveMessage(comm.GetStream());

            if (choice.MessageSend == 1)
            {
                //Launch the thread to create a new topic
                MessageMenu mn = new MessageMenu(1);
                Net.sendMessage(comm.GetStream(), mn);
                Thread newTopicThread = new Thread(new ThreadStart(createTopic));
                newTopicThread.Start();
            }
            else if (choice.MessageSend == 2)
            {
                //Launch the connection thread
                MessageMenu mn = new MessageMenu(2);
                Net.sendMessage(comm.GetStream(), mn);
                Thread displayTopicThread = new Thread(new ThreadStart(displayTopics));
                displayTopicThread.Start();
            }
            else if (choice.MessageSend == 3)
            {
                MessageMenu mn = new MessageMenu(3);
                Net.sendMessage(comm.GetStream(), mn);
                Thread displayUserThread = new Thread(new ThreadStart(displayUsers));
                displayUserThread.Start();
            }
            else if (choice.MessageSend == 4)
            {
                MessageMenu mn = new MessageMenu(4);
                Net.sendMessage(comm.GetStream(), mn);

                //Delete the log out user from the connected users
                MessageUser mu = (MessageUser)Net.receiveMessage(comm.GetStream());

                Console.WriteLine(connectedUsers.Remove(mu.getUser()));

                launchApp();
            }
        }
예제 #12
0
        public void connectedActions()
        {
            //Create a message for the selection of the menu
            MessageMenu mn = new MessageMenu(0);

            Console.WriteLine("\t\t*********************************************");
            Console.WriteLine("\t\t********** WELCOME " + user.Login + " **********");
            Console.WriteLine("\t\t*********************************************");
            Console.WriteLine("\t\t1. Create a topic");
            Console.WriteLine("\t\t2. Display topics");
            Console.WriteLine("\t\t3. Send a private messsage");
            Console.WriteLine("\t\t4. Log out");


            //Read the user's choice and send it
            mn.MessageSend = Int32.Parse(Console.ReadLine());
            Net.sendMessage(comm.GetStream(), mn);

            mn = (MessageMenu)Net.receiveMessage(comm.GetStream());

            if (mn.MessageSend == 1)
            {
                createTopic();
            }
            else if (mn.MessageSend == 2)
            {
                displayTopics();
            }
            else if (mn.MessageSend == 3)
            {
                displayUsers();
            }
            else if (mn.MessageSend == 4)
            {
                Net.sendMessage(comm.GetStream(), new MessageUser(user.Id_user, user.Login, user.Password, true));
                application();
            }
        }
예제 #13
0
        /// <summary>
        /// Create the game scene
        /// </summary>
        public GameScene(GameEngine engine) : base(0, 0)
        {
            // Create all of the sub-menus
            StatusMenu    = new StatusMenu(0, 0, 15, engine.CONSOLE_HEIGHT);
            MessageMenu   = new MessageMenu(14, 50, engine.CONSOLE_WIDTH - 14, engine.CONSOLE_HEIGHT - 50);
            DungeonScreen = new DungeonScreen(16, 2, AscensionGame.DungeonWidth, AscensionGame.DungeonHeight, engine);
            InventoryMenu = new InventoryMenu(14, 0, engine.CONSOLE_WIDTH - 14, engine.CONSOLE_HEIGHT - 1, engine);
            SkillMenu     = new SkillMenu(14, 0, engine.CONSOLE_WIDTH - 14, engine.CONSOLE_HEIGHT - 1, engine);

            // Attach all of the sub-menus
            this.AttachChild("Status", StatusMenu);
            this.AttachChild("Message", MessageMenu);
            this.AttachChild("Dungeon", DungeonScreen);
            this.AttachChild("Inventory", InventoryMenu);
            this.AttachChild("Skill", SkillMenu);

            UniqueMenus = new List <string> {
                "Dungeon",
                "Message",
                "Inventory",
                "Skill"
            };
        }
예제 #14
0
 // Start is called before the first frame update
 private void Start()
 {
     instance = this;
     InputSetting(false);
 }
예제 #15
0
 public PlayTalkText(string talktext,MessageMenu messagemenu)
 {
     TalkText = talktext;
     Menu = messagemenu;
 }
예제 #16
0
 public void init(MyCharacterController owner, PlayerController customer, CommodityList commoditylist, bool playersellmode = false)
 {
     WindowOwner = owner;
     PlayerSellMode = playersellmode;
     Customer = customer;
     CommodityList = commoditylist;
     if (PlayerSellMode)
     {
         // プレイヤが持ち物を売るとき
         initPlayerSellMode();
     }
     else
     {
         // 販売
         initNormalMode();
     }
     MaxPageNum = (int)Mathf.Ceil(Commodities.Length / (float)Window.RowSize);
     CurrentPageNum = 0;
     Debug.LogFormat("C:{0} R:{1} P:{2}",Commodities.Length,Window.RowSize,MaxPageNum);
     setOnePageTexts();
     clearMultiSelected();
     Message = new MessageMenu(this.WindowOwner);
 }
 // Use this for initialization
 public override void Start()
 {
     //Debug.Log(ccm.name);
     if (messagemenu == null) messagemenu = new MessageMenu(null, new Vector2(0, Screen.height / 2), new Vector2(Screen.width, Screen.height / 2));
     MoveRate = DefaultSpeed;
     Parameter.startControll();
 }
예제 #18
0
        public void joinPrivateChat()
        {
            //Receive the user destination chosen and the user

            //Id of the receiver
            MessageMenu choice       = (MessageMenu)Net.receiveMessage(comm.GetStream());
            User        userReceiver = new User(0, null, null);

            //Sender
            MessageUser mu         = (MessageUser)Net.receiveMessage(comm.GetStream());
            User        userSender = mu.getUser();



            //Select the receiver :
            foreach (User u in users)
            {
                if (choice.MessageSend == u.Id_user)
                {
                    userReceiver.Id_user  = choice.MessageSend;
                    userReceiver.Login    = u.Login;
                    userReceiver.Password = u.Password;
                }
            }

            List <User> usersChat = new List <User>();

            Console.WriteLine("The sender is " + userSender.Login);
            usersChat.Add(userSender);
            usersChat.Add(userReceiver);

            //Search for the conv in the list of private messages
            bool        valid          = false;
            PrivateChat oldPrivateChat = new PrivateChat();

            foreach (PrivateChat pv in privateChats)
            {
                if ((usersChat[0].Id_user == pv.UsersChat[0].Id_user && usersChat[1].Id_user == pv.UsersChat[1].Id_user) || (usersChat[1].Id_user == pv.UsersChat[0].Id_user && usersChat[0].Id_user == pv.UsersChat[1].Id_user))
                {
                    valid          = true;
                    oldPrivateChat = pv;
                    break;
                }
            }

            Thread displayUserChatThread = new Thread(new ParameterizedThreadStart(displayUserChat));

            if (valid == true)
            {
                //Print the chatters :
                foreach (User u in oldPrivateChat.UsersChat)
                {
                    Console.WriteLine(u.Login);
                }


                Net.sendMessage(comm.GetStream(), new MessagePrivate(oldPrivateChat));
                displayUserChatThread.Start(oldPrivateChat);
            }
            else if (valid == false)
            {
                //Creation of the private conversation
                string              titleChat           = "Private Chat with " + userReceiver.Login + " and " + userSender.Login;
                Conversation        privateMessage      = new Conversation("test private message", userReceiver);
                List <Conversation> privateConversation = new List <Conversation>();
                PrivateChat         newPrivateChat      = new PrivateChat(1, titleChat, 0, privateConversation, usersChat);

                privateChats.Add(newPrivateChat);


                //Print the chatters :
                foreach (User u in newPrivateChat.UsersChat)
                {
                    Console.WriteLine(u.Login);
                }


                Net.sendMessage(comm.GetStream(), new MessagePrivate(newPrivateChat));
                displayUserChatThread.Start(newPrivateChat);
            }
        }