Esempio n. 1
0
 def click_tinypng_buffer(self):
     '''
     点击tinyPNG buff图标
     '''
     print("使用tinyPNG压缩所有资源图片")
     fairy_id = self.FairyFileNamelabel.text()
     if(fairy_id == "..."):
         return
     
     reply = QMessageBox.information(self, "TinyPNG压缩图片询问", "是否需要使用TinyPNG压缩精灵资源中所有的图片?\n(此操作用时较多,会造成程序卡住很久很久1张图大概4s时间处理,操作完毕后能永久大大减少图片大小,不会对损坏图片质量,重复压缩无效)", QMessageBox.Yes|QMessageBox.No, QMessageBox.Yes)
     if(reply == QMessageBox.No):
         return
     #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     # 有待优化
     #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
     
     # 获取所有图片资源的的位置list
     all_picture_list = []
     
     from infoTool.load_Fairy_From_XML_File import get_FairyInfo 
     import xml.etree.cElementTree as ET
     from infoTool.load_Project_Location import get_TheCuiteFolderLocation
     xml_add = get_FairyInfo(fairy_id).resourceLocation
     tree = ET.parse(xml_add) 
     root = tree.getroot()   # 获取根节点
     
     for resource_set in root.find("动作资源"):
         resource_set_location = get_TheCuiteFolderLocation(fairy_id) + resource_set.attrib.get("资源地址")
         for picture_node in resource_set:
             picture_file_name = picture_node.get("图像")
             picture_location = resource_set_location+picture_file_name # 计算资源路径
             all_picture_list.append(picture_location)
     
     from model import TinyPNG
     TinyPNG.compressing_image_overwirte_source_file_list(all_picture_list)
     TinyPNG.add_compressed_id(fairy_id)
     self.tinypng_buff_label.setIcon(fairy_tab_console.get_icon("buff_box"))
def load_animation_from_xml(fairyID):
    print("读取动作xml......")

    xml_add = get_FairyInfo(fairyID).resourceLocation
    print(xml_add)
    #     print(xml_add)

    #载入xml文件进行分析
    tree = ET.parse(xml_add)
    root = tree.getroot()  # 获取根节点

    # 状态对象,用于处理动画状态
    situation = Situation()

    animation_dict = _load_animation_register_info(root)  # 载入动画注册信息
    logic_dict = _load_animation_logic_info(root, situation)  # 载入动画逻辑信息
    resource_dict = _load_animation_resource(root, fairyID)  # 载入动画资源信息
    mouse_animation = _load_mouse_animation(root, situation)  # 载入鼠标动画信息
    signal_animation = _load_signal_animation(root, situation)  # 载入信号动画信息
    init_AnimationID = _load_init_animation(root)  # 载入初始动画信息

    # 检查错误
    check_error(animation_dict, logic_dict, resource_dict, mouse_animation,
                signal_animation, init_AnimationID)

    animation_console = AnimationConsole(animation_dict, logic_dict,
                                         resource_dict, mouse_animation,
                                         signal_animation, init_AnimationID,
                                         situation)

    #保存简要动画信息
    save_general_fairy_info_to_file(fairyID, animation_dict, logic_dict,
                                    resource_dict, mouse_animation,
                                    signal_animation, init_AnimationID)

    return animation_console
def get_fairy_info(fairyID):
    return get_FairyInfo(fairyID)
Esempio n. 4
0
def get_fairy_info(fairyID):
    '''
    传入精灵id,返回精灵信息(Fairy类实例)
    '''
    from infoTool.load_Fairy_From_XML_File import get_FairyInfo
    return get_FairyInfo(fairyID)
Esempio n. 5
0
        '''
        根据传入的动作ID更变动作,强制变更
        '''
        self.animation_player.change_animation_by_animation_id(animation_id)
        
    def change_Aniamtion_by_signal(self, signal_name):
        '''
        根据传入的信号更变动作,强制变更。
        '''
        aim = self.signal_Animation.signal_animation_dict.get(signal_name)
        if(aim is None):
            return
        if(aim["当前动画id"] is not None and aim["当前动画id"] != self.animation_player.now_register.animation_id):
            return
        if(aim["发生条件"] is not None and check_all_condiction_in_list(aim["发生条件"]) == False):
            return
        
        self.changeAnimationByID(aim.get("目标动画"))
    

if __name__ == '__main__':
    # 读取fairy信息
    from infoTool.load_Fairy_From_XML_File import get_FairyInfo
    fairy = get_FairyInfo("vat")
        
    # 加载动画
    from infoTool.load_Animation_from_xml import load_animation_from_xml
    animationConsole = load_animation_from_xml(fairy.id)
    for a in range(1,20):
        k = animationConsole.get_next_resource()
#         print(k)