Created
December 28, 2016 04:43
-
-
Save xebecnan/289ea071d6be7f4022d3e66fcb9772b9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"HYDRA : OPEN LR UI RES EDITOR { | |
nmap <C-k> yiw:silent !call-hydra.sh <C-r>"<CR> | |
"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo $LR_ARNAN_HYDRA_WORD:$* | nc -u -w1 $LR_ARNAN_HYDRA_HOST $LR_ARNAN_HYDRA_PORT | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf8 | |
import os | |
import time | |
import socket | |
from subprocess import Popen | |
from openui import openui | |
HOST = '0.0.0.0' | |
PORT = 20127 | |
# CWD = r'..\client\platform\mingw\build' | |
CWD = r'build' | |
BIN = r'lr.exe' | |
def main(): | |
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
s.bind((HOST, PORT)) | |
print 'waiting on port:', PORT | |
while 1: | |
data, addr = s.recvfrom(1024) | |
if len(data) < 512 and data.startswith('hydrarnan:'): | |
print time.strftime('%Y-%m-%d %H:%M:%S'), '**** recv command ****' | |
head, body = data.strip().split(':', 1) | |
print body | |
openui(body) | |
else: | |
print time.strftime('%Y-%m-%d %H:%M:%S'), 'ERROR' | |
print data | |
os.system('pause') | |
if __name__ == '__main__': | |
main() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf8 | |
import os | |
import sys | |
import re | |
from subprocess import Popen | |
DATA_ROOT = r'D:\dev\lr\rawres\res_ui\data\editor_data' + '\\' | |
EDITOR_ROOT = ur'D:\dev\dev_coco\设计文档\svn\editors'.encode('cp936') | |
LOCAL_DIR = r'..\rawres\res_ui\output\pc\ui.lua' | |
def call_editor(exe, arg): | |
cwd = os.getcwd() | |
os.chdir(EDITOR_ROOT) | |
Popen([exe, arg]) | |
os.chdir(cwd) | |
def openui(name): | |
with open(LOCAL_DIR, 'r') as f: | |
c = f.read() | |
cex = re.compile(r'\n\texport = "{}"'.format(name)) | |
cfi = re.compile(r'\n\t-- file: (.*?)\n') | |
for m in re.finditer(r'\n{\n.*?\n},', c, re.S): | |
e = m.group() | |
mex = cex.search(e) | |
if not mex: | |
continue | |
mfi = cfi.search(e) | |
if not mfi: | |
continue | |
path = mfi.group(1) | |
# easyui | |
mui = re.match(r'^(.*)_wrapper_complex\[gen\]\.json$', path) | |
if mui: | |
final = DATA_ROOT + mui.group(1) + '_uiwnd.json' | |
call_editor('easyui.exe', final) | |
break | |
# easycomplex | |
mcx = re.match(r'^(.*)_complex\.json$', path) | |
if mcx: | |
final = DATA_ROOT + path | |
call_editor('easycomplex.exe', final) | |
break | |
# TODO: anim json | |
print 'unknown path type:', path | |
break | |
else: | |
print 'not found:', name | |
if __name__ == '__main__': | |
if len(sys.argv) == 2: | |
openui(sys.argv[1]) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment