示例#1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetMouseButtonDown(0))
     {
         MsgHandler.Send((int)MsgTypeCmd.DoNothing, msg);
     }
 }
示例#2
0
        public Form LoadGroupForm(G_ID windowID)
        {
            int num = Guid.NewGuid().GetHashCode();

            if (10501 >= num && 0 <= num)
            {
                num += 10501;
            }
            Form form = MsgHandler.HandleReturn <Form>("CreateForm", new object[]
            {
                windowID
            });

            if (form == null)
            {
                return(null);
            }
            this.formList.Add(num, form);
            form.InitializeForm();
            if (form.InteractivePanel == null)
            {
                return(null);
            }
            form.WindowID   = num;
            form.Orignal_ID = windowID;
            form.OnLoad();
            if (MsgHandler.Handle("IsNPCTalkState", new object[0]))
            {
                this.AddReserveShowForm(num);
                form.Visible = false;
            }
            this.formDepth.Add(num);
            return(form);
        }
示例#3
0
        public void UnregisterHandler <T>(Action <T> handler = null) where T : new()
        {
            System.Type msg_type = typeof(T);
            System.Reflection.FieldInfo fieldInfo = msg_type.GetField("MSG_ID");
            int msg_id = (int)fieldInfo.GetValue(null);

            if (false == _handlers.ContainsKey((uint)msg_id))
            {
                return;
            }
            MsgHandler <T> msg_handler = (MsgHandler <T>)_handlers[(uint)msg_id];

            if (null != handler)
            {
                msg_handler.onReceive -= handler;
            }
            else
            {
                msg_handler.onReceive = null;
            }

            if (null == msg_handler.onReceive)
            {
                _handlers.Remove((uint)msg_id);
            }
        }
示例#4
0
        private void ListenMessage(object ID, string type, string msg)
        {
            if (PacketView.InvokeRequired)
            {
                try
                {
                    MsgHandler d = new MsgHandler(ListenMessage);
                    this.Invoke(d, new object[] { ID, type, msg });
                }
                catch (System.Exception ex)
                {
                    logger.Error(ex.Message);
                    logger.Error(ex.StackTrace);
                }
            }
            else
            {
                if (PacketView.Items.Count > 200)
                {
                    PacketView.Items.Clear();
                }


                ListViewItem item = PacketView.Items.Insert(0, "" + PacketView.Items.Count);

                item.SubItems.Add("" + ID);
                item.SubItems.Add("");
                //int length = e.Data.Length;
                string strDate = DateTime.Now.ToString("HH:mm:ss");
                item.SubItems.Add(strDate);
                item.SubItems.Add(msg);
                //item.SubItems.Add("" + length);
            }
        }
示例#5
0
    public bool SetFlashLabel(string str)
    {
        if (this == null)
        {
            TsLog.LogWarning("UIListItemContainer NULL", new object[0]);
            return(false);
        }
        this.DeleteListItemContainer();
        bool result = MsgHandler.Handle("ParseEmoticonFlashLabel", new object[]
        {
            this,
            str,
            this.width,
            this.height,
            (int)base.FontSize,
            this.lineSpacing,
            this.anchor,
            this.FontColor
        });

        if (this.bAutoAlpha)
        {
            this.fTotalApha = 0f;
            base.SetAlpha(this.fTotalApha);
        }
        this.FindOuterEdges();
        this.realHight = Mathf.Abs(this.BottomRightEdge().y - this.TopLeftEdge().y);
        return(result);
    }
示例#6
0
    private void SetTextureBundle()
    {
        if (NrTSingleton <NrCharKindInfoManager> .Instance.GetCharKindInfo(this.m_pkSolinfo.GetCharKind()) == null)
        {
            return;
        }
        this.SetGui();
        string costumePortraitPath = NrTSingleton <NrCharCostumeTableManager> .Instance.GetCostumePortraitPath(this.m_pkSolinfo);

        string text = MsgHandler.HandleReturn <string>("PortraitFileName", new object[]
        {
            this.m_pkSolinfo.GetCharKind(),
            (int)(this.m_bBaseGrade - 1)
        });

        if (string.Empty == text)
        {
            return;
        }
        if (!string.IsNullOrEmpty(costumePortraitPath))
        {
            string text2 = MsgHandler.HandleReturn <string>("PortraitCostumeFileName", new object[]
            {
                this.m_pkSolinfo.GetCharKind(),
                (int)(this.m_bBaseGrade - 1),
                costumePortraitPath
            });
            if (!string.IsNullOrEmpty(text2))
            {
                text = text2;
            }
        }
        if (UIDataManager.IsUse256Texture())
        {
            this.FaceImageKey = text + "_256";
        }
        else
        {
            this.FaceImageKey = text + "_512";
        }
        this.BaseRankImageKey   = "rankl" + this.m_bBaseGrade.ToString();
        this.ChangeRankImageKey = "rankm" + this.m_bChangeGrade.ToString();
        if (null == NrTSingleton <UIImageBundleManager> .Instance.GetTexture(this.BaseRankImageKey))
        {
            string  str     = string.Format("{0}", "UI/Soldier/" + this.BaseRankImageKey + NrTSingleton <UIDataManager> .Instance.AddFilePath);
            WWWItem wWWItem = Holder.TryGetOrCreateBundle(str + Option.extAsset, NkBundleCallBack.UIBundleStackName);
            wWWItem.SetItemType(ItemType.USER_ASSETB);
            wWWItem.SetCallback(new PostProcPerItem(this.SetBundleImage), this.BaseRankImageKey);
            TsImmortal.bundleService.RequestDownloadCoroutine(wWWItem, DownGroup.RUNTIME, true);
        }
        if (null == NrTSingleton <UIImageBundleManager> .Instance.GetTexture(this.ChangeRankImageKey))
        {
            string  str2     = string.Format("{0}", "UI/Soldier/" + this.ChangeRankImageKey + NrTSingleton <UIDataManager> .Instance.AddFilePath);
            WWWItem wWWItem2 = Holder.TryGetOrCreateBundle(str2 + Option.extAsset, NkBundleCallBack.UIBundleStackName);
            wWWItem2.SetItemType(ItemType.USER_ASSETB);
            wWWItem2.SetCallback(new PostProcPerItem(this.SetBundleImage), this.ChangeRankImageKey);
            TsImmortal.bundleService.RequestDownloadCoroutine(wWWItem2, DownGroup.RUNTIME, true);
        }
        this.eBUNDLEDOWN = Myth_Evolution_Success_DLG.eBUNDLEDOWNSTATE.eBUNDLE_DOWNING;
    }
示例#7
0
    public static void Recv_LS_LOGIN_USER_ACK(NkDeserializePacket kDeserializePacket)
    {
        LS_LOGIN_USER_ACK packet = kDeserializePacket.GetPacket <LS_LOGIN_USER_ACK>();

        if (packet.Result != 0)
        {
            string message = string.Empty;
            if (packet.Result == 2)
            {
                message = NrTSingleton <NrTextMgr> .Instance.GetTextFromPreloadText("Message5");
            }
            else
            {
                message = NrTSingleton <NrTextMgr> .Instance.GetTextFromPreloadText("Message2");
            }
            Main_UI_SystemMessage.ADDMessage(message);
            TsLog.LogError("LoginFailed = {0}", new object[]
            {
                (eRESULT)packet.Result
            });
            BaseNet_Login.GetInstance().Quit();
            return;
        }
        NrTSingleton <NkCharManager> .Instance.m_kCharAccountInfo.m_szAuthKey     = TKString.NEWString(packet.szAuthKey);
        NrTSingleton <NkCharManager> .Instance.m_kCharAccountInfo.m_nSerialNumber = packet.nSerialNumber;
        Debug.LogWarning("Logged in from login server.");
        MsgHandler.Handle("Rcv_LOGIN_USER_ACK", new object[0]);
    }
示例#8
0
        public void TestPubSub()
        {
            uint loopSize = 100;

            Console.WriteLine("Testing PubSub benchmark..., {0} times", loopSize);
            NetMQMessageBus busAlarm = new NetMQMessageBus();
            NetMQMessageBus busEt    = new NetMQMessageBus();

            busAlarm.Start(Path.Combine(xmlPath, "AlarmService.xml"));
            busEt.Start(Path.Combine(xmlPath, "EtService.xml"));
            MsgHandler handler = new MsgHandler {
                Received = 0, Name = "H2(ET)"
            };

            long start = DateTime.Now.Ticks;

            busEt.Subscriber("alarm", "你好", handler.OnMessageReceived);
            // alarm publish to et
            new Thread(new MsgPublisher {
                bus = busAlarm, Topic = "你好", LoopSize = loopSize
            }.DoWork).Start();
            while (handler.Received != loopSize)
            {
                Thread.Sleep(10);
            }
            double elapsed = (DateTime.Now.Ticks - start) / 10000000.0; //s
            double speed   = loopSize / elapsed;

            // 15479
            Console.WriteLine("DONE, loops = {0},Speed = {1:#0.00} msg/s", handler.Received, speed);
            busAlarm.Stop();
            busEt.Stop();
        }
示例#9
0
        private void ListenMessage(object ID, string type, string msg)
        {
            if (this.PacketView.InvokeRequired)
            {
                try
                {
                    MsgHandler method = new MsgHandler(this.ListenMessage);
                    base.Invoke(method, new object[]
                    {
                        ID,
                        type,
                        msg
                    });
                    return;
                }
                catch (Exception ex)
                {
                    ServerForm.logger.Error(ex.Message);
                    ServerForm.logger.Error(ex.StackTrace);
                    return;
                }
            }
            if (this.PacketView.Items.Count > 200)
            {
                this.PacketView.Items.Clear();
            }
            ListViewItem listViewItem = this.PacketView.Items.Insert(0, string.Concat(this.PacketView.Items.Count));

            listViewItem.SubItems.Add(string.Concat(ID));
            listViewItem.SubItems.Add("");
            string text = DateTime.Now.ToString("HH:mm:ss");

            listViewItem.SubItems.Add(text);
            listViewItem.SubItems.Add(msg);
        }
示例#10
0
 public void Subscribe(string service, string topic, MsgHandler handler)
 {
     if (MsgBus != null)
     {
         MsgBus.Subscriber(service, topic, handler);
     }
 }
 public void ParseLinkText(ref string msg, ITEM linkItem)
 {
     if (linkItem != null && linkItem.m_nItemUnique != 0)
     {
         int num = msg.IndexOf('<');
         if (0 < num)
         {
             int num2 = msg.IndexOf('>', num);
             if (0 < num2)
             {
                 int    num3 = msg.IndexOf('\0');
                 string text = MsgHandler.HandleReturn <string>("GetItemName", new object[]
                 {
                     linkItem
                 });
                 string b = msg.Substring(num + 1, num2 - (num + 1));
                 if (text == b)
                 {
                     string str  = msg.Substring(0, num);
                     string str2 = "{@I" + text + "}";
                     string str3 = string.Empty;
                     if (num3 > 0)
                     {
                         str3 = msg.Substring(num2 + 1, num3 - (num2 + 1));
                     }
                     else
                     {
                         str3 = msg.Substring(num2 + 1, msg.Length - (num2 + 1));
                     }
                     msg = str + str2 + str3;
                 }
             }
         }
     }
 }
    public static NkUtil.REQUEST_CHAR_TEXTURE_INFO RequestCharTexture(eCharImageType type, int kind, int solgrade, NkUtil.RequestCharPortraitCallback callbackDelegate, string costume = "")
    {
        NkUtil.REQUEST_CHAR_TEXTURE_INFO result = default(NkUtil.REQUEST_CHAR_TEXTURE_INFO);
        string text = MsgHandler.HandleReturn <string>("PortraitFileName", new object[]
        {
            kind,
            solgrade
        });

        if (string.Empty == text)
        {
            return(result);
        }
        if (!string.IsNullOrEmpty(costume))
        {
            string text2 = MsgHandler.HandleReturn <string>("PortraitCostumeFileName", new object[]
            {
                kind,
                solgrade,
                costume
            });
            if (!string.IsNullOrEmpty(text2))
            {
                text = text2;
            }
        }
        if (type == eCharImageType.SMALL)
        {
            result._imageKey = text + "_64";
        }
        else if (type == eCharImageType.MIDDLE)
        {
            result._imageKey = text + "_256";
        }
        else if (type == eCharImageType.LARGE)
        {
            if (UIDataManager.IsUse256Texture())
            {
                result._imageKey = text + "_256";
            }
            else
            {
                result._imageKey = text + "_512";
            }
        }
        result._tex2D = NrTSingleton <UIImageBundleManager> .Instance.GetTexture(result._imageKey);

        if (result._tex2D != null)
        {
            return(result);
        }
        object[] callBackParam = new object[]
        {
            callbackDelegate,
            result._imageKey
        };
        NrTSingleton <UIImageBundleManager> .Instance.RequestCharImageCustomParam(result._imageKey, type, new PostProcPerItem(NkUtil.CharPortraitBundleCallback), callBackParam);

        return(result);
    }
示例#13
0
 public override void SetComponent()
 {
     this.m_ListBox = (base.GetControl("NLB_FaceBooK") as NewListBox);
     this.m_btnBack = (base.GetControl("BT_Back") as Button);
     this.m_btnBack.AddValueChangedDelegate(new EZValueChangedDelegate(this.OnClickPrev));
     this.m_btnNext = (base.GetControl("BT_Next") as Button);
     this.m_btnNext.AddValueChangedDelegate(new EZValueChangedDelegate(this.OnClickNext));
     this.m_bxPage = (base.GetControl("Box_Page") as Box);
     MsgHandler.Handle("FacebookFriendDataArrage", new object[0]);
     this.m_InviteList = new List <FacebookUserData>(NmFacebookManager.instance.FriendsData.Values);
     if (this.m_InviteList != null && this.m_InviteList.Count > 0)
     {
         this.m_InviteList.Sort(new Comparison <FacebookUserData>(this.ComparerData));
     }
     TsLog.LogWarning("m_InviteList Count = {0} NmFacebookManager.instance.FriendsData.Count = {1}", new object[]
     {
         this.m_InviteList.Count,
         NmFacebookManager.instance.FriendsData.Count
     });
     this.m_nCurPage = 1;
     this.m_nMaxPage = this.m_InviteList.Count / 4 + 1;
     this.PageView();
     this.RequestData();
     this.UpdateList();
 }
示例#14
0
        //Clean up anything we need to here
        public void Dispose()
        {
            if (Initialized == false)
            {
                return;
            }

            UnsubscribeEvents();

            RoutineHandler?.CleanUp();

            CommandHandler.CleanUp();
            ClientService?.CleanUp();

            MsgHandler?.CleanUp();

            if (ClientService?.IsConnected == true)
            {
                ClientService.Disconnect();
            }

            //Clean up and relinquish the virtual controllers when we're done
            InputGlobals.ControllerMngr?.CleanUp();

            instance = null;
        }
示例#15
0
文件: NetMgr.cs 项目: midgithub/notes
 public void bindMsgHandler(Int16 cmd, MsgHandler handler)
 {
     if (m_net != null)
     {
         m_net.bindMsgHandler((Int16)(cmd), handler);
     }
 }
        public void SetItemTexture(int ItemUnique, int MInLevel, bool isMinLevelShow = true, float ResizeRate = 1f)
        {
            base.SetTexture(MsgHandler.HandleReturn <UIBaseInfoLoader>("GetItemTexture", new object[]
            {
                ItemUnique
            }));
            this.downText.Text = string.Empty;
            this.upText.Text   = string.Empty;
            UIBaseInfoLoader uIBaseInfoLoader = MsgHandler.HandleReturn <UIBaseInfoLoader>("GetLegendItemGrade", new object[]
            {
                ItemUnique
            });

            if (uIBaseInfoLoader != null)
            {
                this.upText.SetSize(uIBaseInfoLoader.UVs.width * ResizeRate, uIBaseInfoLoader.UVs.height * ResizeRate);
                this.upText.SetAnchor(SpriteRoot.ANCHOR_METHOD.UPPER_LEFT);
                this.upText.SetTexture(uIBaseInfoLoader);
                this.upText.DeleteSpriteText();
                if (isMinLevelShow)
                {
                    this.downText.Visible = true;
                    this.downText.SetCharacterSize(20f);
                    this.downText.Text = NrTSingleton <UIDataManager> .Instance.GetString("Lv.", MInLevel.ToString());

                    this.downText.gameObject.transform.localPosition = new Vector3(0f, -(this.height - this.fontSize - 2f), -0.02f);
                }
            }
        }
 public void SetItemTexture(int unique)
 {
     base.SetTexture(MsgHandler.HandleReturn <UIBaseInfoLoader>("GetItemTexture", new object[]
     {
         unique
     }));
 }
示例#18
0
文件: Form1.cs 项目: muairui/c-
        void Start()
        {
            //命名方法实例化
            MsgHandler msgdele = new MsgHandler(MsgShow);

            //使用命名方法
            //msgdele("命名方法");             //线程内调用
            richTextBox1.Invoke(msgdele, "命名方法");   //线程外调用

            //匿名方法  委托类型  委托变量 = delegate (【参数列表】){代码块};
            MsgHandler msgdels = delegate(string txt)
            {
                MsgShow(txt);
            };


            //线程内调用
            //msgdels("匿名方法");

            //线程外调用
            richTextBox1.Invoke(msgdele, "匿名方法");


            //lambda 声明方法
            MsgHandler msglambda = p => { MsgShow(p); };

            //msglambda("lambda");

            //线程外调用
            richTextBox1.Invoke(msglambda, "lambda");
        }
 public void SetOpenList(bool show)
 {
     this.bShow = show;
     if (TsPlatform.IsMobile)
     {
         if (show)
         {
             MsgHandler.Handle("ShowDropDownDLG", new object[]
             {
                 this
             });
         }
         else
         {
             NrTSingleton <FormsManager> .Instance.CloseForm(G_ID.MOBILE_DROPDOWN_DLG);
         }
     }
     else
     {
         this.Visible = this.bShow;
         if (null != base.BG)
         {
             if (this.viewableArea.y == 0f)
             {
                 base.BG.Visible = false;
             }
             else
             {
                 base.BG.Visible = this.bShow;
             }
         }
         this.clipWhenMoving = true;
     }
 }
示例#20
0
        public void TestOpenClose()
        {
            NetMQMessageBus busAlarm = new NetMQMessageBus();
            NetMQMessageBus busEt    = new NetMQMessageBus();
            uint            loopSize = 10;
            uint            sendloop = 1;

            Console.WriteLine("Testing start/stop benchmark..., {0} times", loopSize);
            for (uint i = 0; i < loopSize; i++)
            {
                busAlarm.Start(Path.Combine(xmlPath, "AlarmService.xml"));
                busEt.Start(Path.Combine(xmlPath, "EtService.xml"));
                MsgHandler h2 = new MsgHandler {
                    Received = 0, Name = "H2(ET)"
                };
                busEt.Pull(h2.OnMessageReceived);
                new Thread(new MsgPusher {
                    Name = "et", bus = busAlarm, LoopSize = sendloop
                }.DoWork).Start();

                while (h2.Received != sendloop)
                {
                    Thread.Sleep(10);
                }
                busAlarm.Stop();
                busEt.Stop();
            }
            Console.WriteLine("Done!");
        }
示例#21
0
    public void ChangeIntroMsg(IUIObject obj)
    {
        if (!this.bChangeIntroMsg)
        {
            this.m_taIntroMsg.controlIsEnabled = true;
            this.m_taIntroMsg.Text             = string.Empty;
            this.m_taIntroMsg.SetFocus();
            this.bChangeIntroMsg          = true;
            this.m_BtnChangeIntroMsg.Text = NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("547");
        }
        else
        {
            this.m_taIntroMsg.controlIsEnabled = false;
            this.m_BtnChangeIntroMsg.Text      = NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("557");

            this.bChangeIntroMsg = false;
            if ("true" == MsgHandler.HandleReturn <string>("ReservedWordManagerIsUse", new object[0]))
            {
                this.m_taIntroMsg.Text = MsgHandler.HandleReturn <string>("ReservedWordManagerReplaceWord", new object[]
                {
                    this.m_taIntroMsg.Text
                });
            }
            if (this.m_taIntroMsg.Text.Contains("*"))
            {
                Main_UI_SystemMessage.ADDMessage(NrTSingleton <NrTextMgr> .Instance.GetTextFromNotify("797"), SYSTEM_MESSAGE_TYPE.NAGATIVE_MESSAGE);
            }
            GS_CHARACTER_INTRO_MSG_SET_REQ gS_CHARACTER_INTRO_MSG_SET_REQ = new GS_CHARACTER_INTRO_MSG_SET_REQ();
            TKString.StringChar(this.m_taIntroMsg.Text, ref gS_CHARACTER_INTRO_MSG_SET_REQ.szIntromsg);
            SendPacket.GetInstance().SendObject(eGAME_PACKET_ID.GS_CHARACTER_INTRO_MSG_SET_REQ, gS_CHARACTER_INTRO_MSG_SET_REQ);
        }
    }
示例#22
0
        public void TestPushPull()
        {
            uint loopSize = 10000;

            Console.WriteLine("Testing pull/push benchmark..., {0} times", loopSize);
            NetMQMessageBus busAlarm = new NetMQMessageBus();
            NetMQMessageBus busEt    = new NetMQMessageBus();

            busAlarm.Start(Path.Combine(xmlPath, "AlarmService.xml"));
            busEt.Start(Path.Combine(xmlPath, "EtService.xml"));
            MsgHandler h2 = new MsgHandler {
                Received = 0, Name = "H2(ET)"
            };

            long start = DateTime.Now.Ticks;

            busEt.Pull(h2.OnMessageReceived);
            new Thread(new MsgPusher {
                Name = "et", bus = busAlarm, LoopSize = loopSize
            }.DoWork).Start();

            while (h2.Received != loopSize)
            {
                Thread.Sleep(10);
            }
            double elapsed = (DateTime.Now.Ticks - start) / 10000000.0; //s
            double speed   = loopSize / elapsed;

            // 15479
            Console.WriteLine("DONE, loops = {0},Speed = {1:#0.00} msg/s", h2.Received, speed);
            busAlarm.Stop();
            busEt.Stop();
        }
示例#23
0
        private void SubOnReceiveReady(object sender, NetMQSocketEventArgs e)
        {
            NetMQSocket socket = e.Socket;
            bool        hasMore;

            try
            {
                string msg = Encoding.UTF8.GetString(socket.Receive(SendReceiveOptions.DontWait, out hasMore));
                if (msg.Length > 0)
                {
                    string topic, body, serviceName;
                    if (SpliteMsg(msg, out topic, out body))
                    {
                        serviceName = GetServiceName(_sub_links, Encoding.UTF8.GetString(socket.Options.Identity));
                        MsgHandler h = this.GetTopicSubscriber(serviceName, topic);
                        if (h != null)
                        {
                            h(msg);
                        }
                    }
                }
            }
            catch (Exception ce)
            {
                Console.WriteLine("onsubscribe Error: {0}", ce.Message);
                log.Error("onsubscribe message error: ", ce);
            }
        }
示例#24
0
        /// <summary>
        /// 添加消息处理函数
        /// </summary>
        /// <param name="msgID">消息ID</param>
        /// <param name="msgProc">消息处理函数</param>
        public void AddMsgHandler(int msgID, MsgHandler msgProc)
        {
            // Debug.Log("添加消息ID: " + msgID);
            if (msgProc == null)
            {
                return;
            }

            /*foreach(KeyValuePair<int, MsgHandler> kvp in m_msgHandlerMap)
             * {
             *  int key = kvp.Key;
             *  Debug.Log("消息:" + key);
             * }*/

            if (m_msgHandlerMap.ContainsKey(msgID) == false)
            {
                // 注册消息处理函数
                m_msgHandlerMap.Add(msgID, msgProc);
                // 注入消息路由表
                MsgHandlerMap.Add(msgID, ID);
            }
            else
            {
            }
        }
示例#25
0
        private void ListenMessage(object ID, string type, string msg)
        {
            if (PacketView.InvokeRequired)
            {
                try
                {
                    MsgHandler d = new MsgHandler(ListenMessage);
                    this.Invoke(d, new object[] { ID,type, msg });
                }
                catch (System.Exception ex)
                {
                    logger.Error(ex.Message);
                    logger.Error(ex.StackTrace);
                }
            }
            else
            {
                if (PacketView.Items.Count > 200)
                    PacketView.Items.Clear();


                ListViewItem item = PacketView.Items.Insert(0, "" + PacketView.Items.Count);

                item.SubItems.Add("" + ID);
                item.SubItems.Add("");
                //int length = e.Data.Length;
                string strDate = DateTime.Now.ToString("HH:mm:ss");
                item.SubItems.Add(strDate);
                item.SubItems.Add(msg);
                //item.SubItems.Add("" + length);
            }
        }
示例#26
0
    public void ChangeNameAck(long nResult)
    {
        if (nResult == 0L)
        {
            TsLog.Log("이름 변경 성공", new object[0]);
            NrCharUser nrCharUser = NrTSingleton <NkCharManager> .Instance.GetChar(1) as NrCharUser;

            NrPersonInfoBase personInfo = nrCharUser.GetPersonInfo();
            personInfo.SetCharName(this.m_newName);
            NrTSingleton <NrMainSystem> .Instance.SetLatestPersonID(personInfo.GetPersonID().ToString());

            MsgHandler.Handle("Req_CONNECT_GAMESERVER_REQ", new object[]
            {
                personInfo.GetPersonID()
            });
            FacadeHandler.MoveStage(Scene.Type.PREPAREGAME);
            NrTSingleton <NkQuestManager> .Instance.SortingQuestInGroup();

            NrTSingleton <FormsManager> .Instance.CloseForm(G_ID.CHANGENAME_DLG);
        }
        else if (nResult == -20L)
        {
            Main_UI_SystemMessage.ADDMessage(NrTSingleton <NrTextMgr> .Instance.GetTextFromNotify("90"));
            this.m_btOk.SetEnabled(true);
        }
        else
        {
            Main_UI_SystemMessage.ADDMessage(NrTSingleton <NrTextMgr> .Instance.GetTextFromNotify("91"));
            this.m_btOk.SetEnabled(true);
        }
    }
示例#27
0
    /*********************************
    * 函数说明: 移除监听者
    * 返 回 值: void
    * 参数说明: message@消息ID,handler@消息响应函数
    * 注意事项: 无
    *********************************/
    public void RemoveListener(int message, MsgCallback callback)
    {
        List <MsgHandler> handlerList;

        if (_handlerTable.TryGetValue(message, out handlerList))
        {
            for (int i = 0; i < handlerList.Count; i++)
            {
                MsgHandler handler = handlerList[i];
                if (handler.callback == callback)
                {
                    if (handler.state == OperateState.Handle)
                    {
                        handler.state = OperateState.Remove;
                    }
                    else
                    {
                        handlerList.Remove(handler);
                    }
                    break;
                }
            }

            if (handlerList.Count == 0)
            {
                _handlerTable.Remove(message);
            }
        }
    }
示例#28
0
        public void SetTexture(eCharImageType type, int kind, int solgrade, string costume = "")
        {
            this.imageKey = string.Empty;
            this.reserve  = false;
            string text = MsgHandler.HandleReturn <string>("PortraitFileName", new object[]
            {
                kind,
                solgrade
            });

            if (string.Empty == text)
            {
                return;
            }
            if (!string.IsNullOrEmpty(costume))
            {
                string text2 = MsgHandler.HandleReturn <string>("PortraitCostumeFileName", new object[]
                {
                    kind,
                    solgrade,
                    costume
                });
                if (!string.IsNullOrEmpty(text2))
                {
                    text = text2;
                }
            }
            this.m_etype = type;
            if (type == eCharImageType.SMALL)
            {
                this.imageKey = text + "_64";
            }
            else if (type == eCharImageType.MIDDLE)
            {
                this.imageKey = text + "_256";
            }
            else if (type == eCharImageType.LARGE)
            {
                if (UIDataManager.IsUse256Texture())
                {
                    this.imageKey = text + "_256";
                }
                else
                {
                    this.imageKey = text + "_512";
                }
            }
            Texture2D texture = NrTSingleton <UIImageBundleManager> .Instance.GetTexture(this.imageKey);

            if (null != texture)
            {
                base.SetTexture(texture);
                this.reserve = true;
            }
            else
            {
                NrTSingleton <UIImageBundleManager> .Instance.RequestCharImage(this.imageKey, type, new PostProcPerItem(this.SetImage));
            }
        }
示例#29
0
 /// <summary>
 /// Deregisters a handler for the given message type.
 /// </summary>
 public Messenger Deregister(MsgType inType, MsgHandler inHandler)
 {
     if (m_Impl.IsValid)
     {
         m_Impl.Deregister(inType, inHandler);
     }
     return(this);
 }
示例#30
0
 /// <summary>
 /// Registers a temporary handler for the given message type.
 /// </summary>
 public Binding RegisterTemp(MsgType inType, MsgHandler inHandler)
 {
     if (m_Impl.IsValid)
     {
         return(new Binding(this, inType, inHandler));
     }
     return(null);
 }
示例#31
0
 private void loginFailedEvent(P31Error error)
 {
     Debug.Log("Facebook login failed: " + error);
     MsgHandler.Handle("FacebookLoginFailed", new object[]
     {
         error
     });
 }
示例#32
0
        public async void Locating(MsgHandler handler){

			Tap5050WebResponse response = new Tap5050WebResponse ();
			response.available = false;
			response.parsedobject = null;  
			response.exceptionreport = new ExceptionReport ("");

			Position position;

			try{
				position=await locator.GetPositionAsync (10000);    
			}catch{ 
				response.available = false;
				response.exceptionreport = new ExceptionReport ("Can not get Info from GPS");
				response.parsedobject = null;
				if (handler != null) { 
					handler (response);
				} 
				return;
			}  

			//try to get city name 
			if (position != null) {  
 

				NetworkManager manager = new NetworkManager ();


				Dictionary<string,string> parameters = new Dictionary<string,string> ();
				parameters.Add ("lat",position.Latitude.ToString());
				parameters.Add ("lng",position.Longitude.ToString());
				parameters.Add ("username",LocationManager.geonameusername);


				manager.GetLocationfromGEO (parameters,(Tap5050WebResponse webresponse)=>{

					if(webresponse.available){
						var result=(GeonamesCountry)webresponse.parsedobject;  
						response.available = true;
						response.exceptionreport=null;
						response.parsedobject=result;
						if (handler != null) { 
							handler (response);
						}  
					}else{
						response.available = false;
						response.exceptionreport=webresponse.exceptionreport;
						if (handler != null) { 
							handler (response);
						}
					}	
				}); 
			}   
		}
示例#33
0
        public bool RegisterHandler(Api.ENetMsgId id, MsgHandler handler)
        {
            if (msgMap.ContainsKey(id))
            {
                Debug.LogError(id + " is already registered");
                return false;
            }
            Group g = new Group();
            g.handler = new MsgHandler(handler);
            g.action = null;
            msgMap.Add(id, g);

            return true;
        }
示例#34
0
 public void InAppResetPassword(Dictionary<string,string> parameters, MsgHandler responsehander)
 {
     if (parameters.ContainsKey ("token_id") && !string.IsNullOrEmpty (parameters ["token_id"])&&
         parameters.ContainsKey ("new_password") && !string.IsNullOrEmpty (parameters ["new_password"])&&
         parameters.ContainsKey ("old_password") && !string.IsNullOrEmpty (parameters ["old_password"])) {
         string checkuser = String.Format (URLManager.InAppResetPWD + "?token_id={0}",  parameters["token_id"]);
         parameters.Remove ("token_id");
         Tap5050WebRequest webrequest = new Tap5050WebRequest ();
         webrequest.SetURL (checkuser);
         webrequest.parameters = parameters;
         webrequest.verb = HTTPVerb.POST;
         LoadContentThread thread = new LoadContentThread (webrequest, responsehander);
         thread.Start ();
     } else {
         if(responsehander!=null){
             Tap5050WebResponse response = new Tap5050WebResponse ();
             response.available = false;
             response.exceptionreport = new ExceptionReport ("Error:Can not build Request");
             responsehander(response);
         }
     }
 }
示例#35
0
 public void RejectJoinTeamRequest(Dictionary<string,string> parameters, MsgHandler responsehander)
 {
     if (parameters.ContainsKey ("token_id") && !string.IsNullOrEmpty (parameters ["token_id"]) &&
         parameters.ContainsKey ("member_id") && !string.IsNullOrEmpty (parameters ["member_id"])) {
         string fulurl = String.Format (URLManager.JoinTeamRequest + "?token_id={0}&member_id={1}", parameters ["token_id"], parameters ["member_id"]);
         parameters.Remove ("token_id");
         Tap5050WebRequest webrequest = new Tap5050WebRequest ();
         webrequest.SetURL (fulurl);
         webrequest.parameters = parameters;
         webrequest.verb = HTTPVerb.DELETE;
         LoadContentThread thread = new LoadContentThread (webrequest, responsehander);
         thread.Start ();
     } else {
         if(responsehander!=null){
             Tap5050WebResponse response = new Tap5050WebResponse ();
             response.available = false;
             response.exceptionreport = new ExceptionReport ("Error:Can not build Request");
             responsehander(response);
         }
     }
 }
示例#36
0
 public void CheckUserByPhone(Dictionary<string,string> parameters, MsgHandler responsehander)
 {
     if (parameters.ContainsKey ("mphone") && parameters.ContainsKey ("token_id") && !string.IsNullOrEmpty (parameters ["token_id"]) && !string.IsNullOrEmpty (parameters ["mphone"])) {
         string checkuser = String.Format (URLManager.CheckUser + "?token_id={0}&mphone={1}", parameters ["token_id"], parameters ["mphone"]);
         Tap5050WebRequest webrequest = new Tap5050WebRequest ();
         webrequest.SetURL (checkuser);
         webrequest.verb = HTTPVerb.GET;
         LoadContentThread thread = new LoadContentThread (webrequest, responsehander);
         thread.Start ();
     } else {
         if(responsehander!=null){
             Tap5050WebResponse response = new Tap5050WebResponse ();
             response.available = false;
             response.exceptionreport = new ExceptionReport ("Error:Can not build Request");
             responsehander(response);
         }
     }
 }
示例#37
0
        private void showManageSupplier()
        {
            //Create Only One Instance of Form
            frmManageSupplier f = frmManageSupplier.CreateInstance();

            //Craete a delegation to invoke the dbAction of frmManageRecord
            MsgHandler dbAction = new MsgHandler(f.DbAction);
            modDbAction = dbAction;

            //settings for frmManageSUpplier
            f.MdiParent = this;
            f.listView1.Width = Width ;

            showManaged(f);
        }
示例#38
0
 public void GetPositionThreadPool(MsgHandler handler)
 {
     ThreadPool.QueueUserWorkItem((object obj) => {
         Locating(handler);
     }); 
 }
示例#39
0
 public OutputReader(StreamReader sr, MsgHandler Message, StringBuilder sb)
 {
     try
     {
         this.sr = sr;
         this.Message = Message;
         this.sb = sb;
     }
     catch (Exception)
     {
     }
 }
示例#40
0
 //load different image with differnt type, somethimes there may have many image to load with same position.
 //types in
 public void LoadImage(Tap5050ImageFlag imageflag,MsgHandler responsehander)
 {
     if (!string.IsNullOrEmpty(imageflag.url)) {
         Tap5050WebRequest webrequest = new Tap5050WebRequest ();
         webrequest.SetURL (imageflag.url);
         webrequest.verb = HTTPVerb.GET;
         LoadContentThread thread = new LoadContentThread (webrequest,imageflag,responsehander);
         thread.Start ();
     }else {
         if(responsehander!=null){
             Tap5050WebResponse response = new Tap5050WebResponse ();
             response.available = false;
             response.exceptionreport = new ExceptionReport ("Error:Can not build Request");
             responsehander(response);
         }
     }
 }
示例#41
0
 public void GetStateAndProvince(MsgHandler responsehander)
 {
     Tap5050WebRequest webrequest =new Tap5050WebRequest();
     webrequest.SetURL(URLManager.StateAndProvince);
     webrequest.verb = HTTPVerb.GET;
     LoadContentThread thread = new LoadContentThread(webrequest, responsehander);
     thread.Start();
 }
示例#42
0
 //if you need to remeber sth for a web call, call this constructor,
 public LoadContentThread(Tap5050WebRequest webrequest,object flagobj,MsgHandler responsehander)
     : this(webrequest,responsehander)
 {
     nn_flagobject = flagobj;
 }
示例#43
0
 //get location when initialize Homescreen
 public void GetLocationfromGEO(Dictionary<string,string> parameters, MsgHandler responsehander)
 {
     if (parameters.ContainsKey ("lat") && parameters.ContainsKey ("lng")&&parameters.ContainsKey ("username") && !string.IsNullOrEmpty (parameters ["lat"]) && !string.IsNullOrEmpty (parameters ["lng"])&& !string.IsNullOrEmpty (parameters ["username"])) {
         string fulurl = String.Format (URLManager.BaseLocationURL+"?lat={0}&lng={1}&username={2}", parameters ["lat"], parameters ["lng"], parameters ["username"]);
         parameters.Remove ("lat");
         parameters.Remove ("lng");
         parameters.Remove ("username");
         Tap5050WebRequest webrequest = new Tap5050WebRequest ();
         webrequest.SetURL (fulurl);
         webrequest.parameters = parameters;
         webrequest.verb = HTTPVerb.GET;
         LoadContentThread thread = new LoadContentThread (webrequest, responsehander);
         thread.Start ();
     }else {
         if(responsehander!=null){
             Tap5050WebResponse response = new Tap5050WebResponse ();
             response.available = false;
             response.exceptionreport = new ExceptionReport ("Error:Can not build Request");
             responsehander(response);
         }
     }
 }
示例#44
0
 /**
  * @return indicate if successfully construct URL
  **/
 public void GetEvents(Dictionary<string,string> parameters, MsgHandler responsehander)
 {
     if (parameters.ContainsKey ("location") && parameters.ContainsKey ("token_id") && !string.IsNullOrEmpty (parameters ["token_id"]) && !string.IsNullOrEmpty (parameters ["location"])) {
         var url = String.Format (URLManager.Events + "?location={0}&token_id={1}", parameters ["location"], parameters ["token_id"]);
         Tap5050WebRequest webrequest = new Tap5050WebRequest ();
         webrequest.SetURL (url);
         webrequest.verb = HTTPVerb.GET;
         LoadContentThread thread = new LoadContentThread (webrequest, responsehander);
         thread.Start ();
     } else {
         if(responsehander!=null){
             Tap5050WebResponse response = new Tap5050WebResponse ();
             response.available = false;
             response.exceptionreport = new ExceptionReport ("Error:Can not build Request");
             responsehander(response);
         }
     }
 }
示例#45
0
 public LoadContentThread(Tap5050WebRequest webrequest, MsgHandler responsehander)
 {
     nn_webrequest = webrequest;
     nn_responsehander = responsehander;
     exceptionreport = new ExceptionReport();
 }
示例#46
0
        public void GetServerURL(Dictionary<string,string> parameters,MsgHandler responsehander)
        {
            var url = String.Format (URLManager.ServerURL + "?location={0}", parameters ["location"]);
            Tap5050WebRequest webrequest = new Tap5050WebRequest ();
            webrequest.SetURL (url);
            webrequest.verb = HTTPVerb.GET;
            LoadContentThread thread = new LoadContentThread (webrequest, responsehander);
            thread.Start ();

            /*
            Tap5050WebRequest webrequest =new Tap5050WebRequest();
            webrequest.SetURL();
            webrequest.verb = HTTPVerb.GET;
            LoadContentThread thread = new LoadContentThread(webrequest, responsehander);
            thread.Start();
            */
        }
示例#47
0
 //need organization_id
 public void PostRelationship(Dictionary<string,string> parameters, MsgHandler responsehander)
 {
     if (parameters.ContainsKey ("token_id") && parameters.ContainsKey ("location")&&parameters.ContainsKey ("ORGANIZATION_ID") && !string.IsNullOrEmpty (parameters ["token_id"]) && !string.IsNullOrEmpty (parameters ["location"])&& !string.IsNullOrEmpty (parameters ["ORGANIZATION_ID"])) {
         string fulurl = String.Format (URLManager.Relationship+"?token_id={0}&location={1}", parameters ["token_id"], parameters ["location"]);
         parameters.Remove ("token_id");
         parameters.Remove ("location");
         Tap5050WebRequest webrequest = new Tap5050WebRequest ();
         webrequest.SetURL (fulurl);
         webrequest.parameters = parameters;
         webrequest.verb = HTTPVerb.POST;
         LoadContentThread thread = new LoadContentThread (webrequest, responsehander);
         thread.Start ();
     }else {
         if(responsehander!=null){
             Tap5050WebResponse response = new Tap5050WebResponse ();
             response.available = false;
             response.exceptionreport = new ExceptionReport ("Error:Can not build Request");
             responsehander(response);
         }
     }
 }
示例#48
0
		public void GetPosition(MsgHandler handler){ 
			Thread thread = new Thread (new ThreadStart (()=>Locating(handler))); 
			thread.Start ();
		}
示例#49
0
        public void RequestTempPass(Dictionary<string,string> parameters, MsgHandler responsehander)
        {
            if (parameters.ContainsKey ("token_id")&&parameters.ContainsKey ("email")&&parameters.ContainsKey ("ORGANIZATION_ID") &&!string.IsNullOrEmpty (parameters ["token_id"]) &&!string.IsNullOrEmpty (parameters ["email"])&&!string.IsNullOrEmpty (parameters ["ORGANIZATION_ID"]) ) {
                string requesttemppass = String.Format (URLManager.RequestTempPass + "?token_id={0}",  parameters ["token_id"]);
                Tap5050WebRequest webrequest = new Tap5050WebRequest ();
                Dictionary<string,string> tempparameters =new Dictionary<string, string>();
                tempparameters.Add("email",parameters["email"]);
                tempparameters.Add ("ORGANIZATION_ID",parameters["ORGANIZATION_ID"]);

                webrequest.parameters = tempparameters;
                webrequest.SetURL (requesttemppass);
                webrequest.verb = HTTPVerb.POST;
                LoadContentThread thread = new LoadContentThread (webrequest, responsehander);
                thread.Start ();
            }else {
                if(responsehander!=null){
                    Tap5050WebResponse response = new Tap5050WebResponse ();
                    response.available = false;
                    response.exceptionreport = new ExceptionReport ("Error:Can not build Request");
                    responsehander(response);
                }
            }
        }
示例#50
0
 /**
  * @parameters email
  **/
 public void RestPassword(Dictionary<string,string> parameters, MsgHandler responsehander)
 {
     Tap5050WebRequest webrequest =new Tap5050WebRequest();
     webrequest.SetURL(URLManager.RestPassword);
     webrequest.parameters = parameters;
     webrequest.verb = HTTPVerb.POST;
     LoadContentThread thread = new LoadContentThread(webrequest, responsehander);
     thread.Start();
 }
示例#51
0
 public void UpdateAccountInfo(Dictionary<string,string> parameters, MsgHandler responsehander)
 {
     if (parameters.ContainsKey ("token_id") && !string.IsNullOrEmpty (parameters ["token_id"])) {
         string getaccountinfo = String.Format (URLManager.UpdateAccountInfo + "?token_id={0}",  parameters ["token_id"]);
         parameters.Remove ("token_id");
         Tap5050WebRequest webrequest = new Tap5050WebRequest ();
         webrequest.SetURL (getaccountinfo);
         webrequest.parameters = parameters;
         webrequest.verb = HTTPVerb.POST;
         LoadContentThread thread = new LoadContentThread (webrequest, responsehander);
         thread.Start ();
     }else {
         if(responsehander!=null){
             Tap5050WebResponse response = new Tap5050WebResponse ();
             response.available = false;
             response.exceptionreport = new ExceptionReport ("Error:Can not build Request");
             responsehander(response);
         }
     }
 }
 /// <summary>
 /// Adds a Message Handler
 /// </summary>
 /// <param name="msgType">The type of message this should be added to</param>
 /// <param name="del">The delegate method handling the event</param>
 public void On(string msgType, MsgHandler del)
 {
     if (!events.ContainsKey(msgType))
         events.Add(msgType, null);
     events[msgType] = (MsgHandler)events[msgType] + del;
 }
 internal void RegisterHandler(RoomMessageDefine id, MsgHandler handler)
 {
     m_DicHandler[(int)id] = handler;
 }
示例#54
0
        private void showPaymentProcess()
        {
            frmPayment f =  frmPayment.CreateInstance();
            MsgHandler dbAction = new MsgHandler(f.DbAction);

            modDbAction = dbAction;
            f.MdiParent = this;

            showManaged(f);
        }
示例#55
0
        private void showManageOrderOfPayment()
        {
            frmOrPayManageData f = frmOrPayManageData.CreateInstance();
            MsgHandler dbAction = new MsgHandler(f.DbAction);
            showOptions(true);
            modDbAction = dbAction;
            f.MdiParent = this;

              //  f.lvManageRecord.Width = this.Width / 2;
            f.lvManageRecord.Height = this.Height - 295;

            showManaged(f);
            f.manageTopMenu(toolStrip1);
        }