/* --- Static Methods (Interface) --- */ public static void Load() { // connect to the bot server if (HSMPClient.Get() == null) { HSMPClient.Connect("foobar"); } if (NetCache.Get() == null || BnetPresenceMgr.Get() == null || BnetPresenceMgr.Get().GetMyPlayer() == null) { HSMPClient.Get().Send(new MsgStatus(MsgStatus.State.HANDSHAKE_FAILED, MsgStatus.User.CLIENT, "Hearthstone is initializing, please wait...")); return; } if (s_loaded == false) { // create root game object UnityEngine.GameObject root = new UnityEngine.GameObject("HookRoot"); root.transform.parent = BaseUI.Get().transform; // initialize subcomponents AttachScripts(root); InstallNetworkSniffers(root); RegisterMessageListeners(root); s_loaded = true; } HSMPClient.Get().Send(new MsgStatus(MsgStatus.State.CONNECTED, MsgStatus.User.CLIENT, "Success")); }
private static void RegisterMessageListeners(UnityEngine.GameObject root) { HSMPClient c = HSMPClient.Get(); Meta.ResponseInstaller.Register(c); Game.ResponseInstaller.Register(c); Account.ResponseInstaller.Register(c); }
/* --- Static Methods (Interface) --- */ public static bool Connect(string name) { if (s_instance != null) { s_instance.SendDebugMessage("ERROR: tried to connect with an already open HSMPClient..."); return(false); } ClientMessageStream s = ClientMessageStream.Create(name); if (s == null) { return(false); } s_instance = new HSMPClient(s); return(true); }
private bool OnTaskPlayTournament(TaskParamPlayTournament p) { PegasusShared.GameType type = p.Ranked ? PegasusShared.GameType.GT_RANKED : PegasusShared.GameType.GT_UNRANKED; long deckID = GetDeckID(p.DeckIndex); if (deckID == 0) { HSMPClient.Get().SendDebugMessage("invalid deck ID :("); return(false); } GameMgr.Get().FindGame(type, 2, deckID, 0); return(true); }
public void Awake() { HSMPClient.Get().RegisterListener(MsgTaskSet.ID, OnMsgTaskSet); HSMPClient.Get().RegisterListener(MsgTaskGetState.ID, OnMsgTaskGetState); }
private void OnPacketNAckOption() { HSMPClient.Get().SendDebugMessage("NAck Option..."); }
public void Awake() { HSMPClient.Get().RegisterListener(MsgChooseOption.ID, OnMsgChooseOption); Network.Get().RegisterNetHandler(PegasusGame.NAckOption.PacketID.ID, OnPacketNAckOption); }
/* --- Instance Methods (Interface) --- */ public void Awake() { m_serverState = MsgStatus.State.DISCONNECTED; HSMPClient.Get().RegisterListener(MsgStatus.ID, OnMsgStatus); }
public void OnDestroy() { HSMPClient.Get().Send(new MsgStatus(MsgStatus.State.DISCONNECTED, MsgStatus.User.CLIENT, "NORMAL")); HSMPClient.Get().GetStream().Close(); }
public void LateUpdate() { HSMPClient.Get().GetStream().CheckForMessages(MessageHandler.Alloc); HSMPClient.Get().GetStream().Distribute(); }