Пример #1
0
 def testtimerCallback(self, dic):
     plug2 = Plugin.GetPlugin("Test2")
     plug2.Invoke("TestSharedFunction", dic["first"], dic["second"])
     Debug.Log(dic["first"])
     Debug.Log(dic["second"])
     Plugin.DumpObjToFile("testtimerCallback.dict", dic, 3, 20, True, True)
     Plugin.KillTimers()
Пример #2
0
    def init(self):
        import options
        from UnityEngine import Debug

        L = lambda s: Debug.Log("PyWrap: " + s)
        L("init")

        self.events = []

        # should set them
        options.no_update
        options.show_hidden_mode

        options.freeplay = False

        if options.no_update:
            import autoupdate
            autoupdate.Autoupdate = autoupdate.DummyAutoupdate

        L("before gevent")
        from gevent import monkey
        monkey.patch_socket()
        monkey.patch_os()
        monkey.patch_select()
        L("after gevent")

        from game import autoenv
        autoenv.init('Client')

        import thb.ui.ui_meta  # noqa, init ui_meta

        from client.core.executive import Executive
        self.executive = ExecutiveWrapper(Executive, self)
Пример #3
0
def inject_static_linked_extensions():
    try:
        import gevent_ares
        import gevent_core
        import gevent_semaphore
        import msgpack_packer
        import msgpack_unpacker

        sys.modules['gevent.ares'] = gevent_ares
        # sys.modules['gevent.core'] = gevent_core
        sys.modules['gevent._semaphore'] = gevent_semaphore
        sys.modules['msgpack._packer'] = msgpack_packer
        sys.modules['msgpack._unpacker'] = msgpack_unpacker

        import gevent
        import msgpack

        gevent.ares = gevent_ares
        gevent.core = gevent_core
        gevent._semaphore = gevent_semaphore
        msgpack._packer = msgpack_packer
        msgpack._unpacker = msgpack_unpacker

    except Exception:
        from UnityEngine import Debug
        from traceback import format_exc
        Debug.Log('Inject static extension failed.\n\n' + format_exc())
Пример #4
0
def _dbgprint(ins):
    s = [
        'NOP',
        'DUP',
        'GET',
        'CREATE',
        'MOVE',
        'FADE',
        'GRAY',
        'UNGRAY',
        'FATETELL',
        'AREA_HAND',
        'AREA_DECK',
        'AREA_DROP',
        'AREA_PORT0',
        'AREA_PORT1',
        'AREA_PORT2',
        'AREA_PORT3',
        'AREA_PORT4',
        'AREA_PORT5',
        'AREA_PORT6',
        'AREA_PORT7',
        'AREA_PORT8',
        'AREA_PORT9',
    ]
    rst = []
    for i in ins:
        if isinstance(i, int):
            rst.append(s[i])
        else:
            rst.append(repr(i))

    from UnityEngine import Debug
    Debug.Log(repr(rst))
Пример #5
0
    def connect_server(self, host, port):
        from UnityEngine import Debug
        Debug.Log(repr((host, port)))

        @gevent.spawn
        def do():
            Q = self.warpgate.queue_system_event
            Q('connect', self.executive.connect_server((host, port), Q))
Пример #6
0
    def init(self):
        import options
        from UnityEngine import Debug

        L = lambda s: Debug.Log("PyWrap: " + s)
        L("init")

        self.events = []

        # should set them
        options.no_update
        options.no_crashreport
        options.show_hidden_mode

        options.freeplay = False

        if options.no_update:
            import autoupdate
            autoupdate.Autoupdate = autoupdate.DummyAutoupdate

        L("before gevent")
        from gevent import monkey
        monkey.patch_socket()
        monkey.patch_os()
        monkey.patch_select()
        L("after gevent")

        from game import autoenv
        autoenv.init('Client')

        import gamepack.thb.ui.ui_meta  # noqa, init ui_meta

        # For debug
        @gevent.spawn
        def beat():
            while True:
                gevent.sleep(1)
                # self.events.append(("tick",))

        from client.core.executive import Executive
        self.executive = ExecutiveWrapper(Executive, self)
Пример #7
0
 def write(self, data):
     from UnityEngine import Debug
     Debug.Log(data)
Пример #8
0
 def On_ServerShutdown(self):
     Debug.Log("On_ServerShutdown hooked from Python")
Пример #9
0
 def On_PluginInit(self):
     Debug.Log("On_PluginInit hooked from Python")
Пример #10
0
 def On_ServerInit(self):
     Debug.Log("On_ServerInit hooked from Python")
     dic = Plugin.CreateDict()
     dic.Add("first", "timer is:")
     dic.Add("second", "working")
     Plugin.CreateTimer("testtimer", 5000, dic).Start()
Пример #11
0
 def On_AllPluginsLoaded(self):
     Debug.Log("The knights who say NI!")