示例#1
0
 public TextBoxHelper(TSF _tsf, IntPtr _hWnd)
 {
     tsf = _tsf;
     tsf.Active();
     tsf.CreateContext(_hWnd);
     tsf.PushContext();
 }
示例#2
0
        private void InitTSF()
        {
            tsf = new TSF();                        //Need to init at STA Thread
            tsf.AssociateFocus(this.Window.Handle); //Window need to create in a STA Thread
            tsf.Active();
            tsf.CreateContext(this.Window.Handle);
            tsf.PushContext();
#if XNA
            FieldInfo  host    = typeof(Game).GetField("host", BindingFlags.NonPublic | BindingFlags.Instance);
            Type       type    = host.GetValue(Game1.game1).GetType();
            MethodInfo m_idle  = type.GetMethod("ApplicationIdle", BindingFlags.NonPublic | BindingFlags.Instance);
            Harmony    harmony = new Harmony("StardewValley_TSF");
            harmony.Patch(m_idle, null, new HarmonyMethod(typeof(Game1), "HandleMsgFirst"));
#endif
#if Mono
            Type       type    = Game1.game1.Window.GetType();
            MethodInfo m_idle  = type.GetMethod("TickOnIdle", BindingFlags.NonPublic | BindingFlags.Instance);
            Harmony    harmony = new Harmony("StardewValley_TSF");
            harmony.Patch(m_idle, null, new HarmonyMethod(typeof(Game1), "HandleMsgFirst"));//need to handle msg first, or the game will struck after IME actived
#endif
        }