当前位置: 首页>>代码示例>>Java>>正文


Java ProjectInfo.inherit方法代码示例

本文整理汇总了Java中me.ichun.mods.ichunutil.common.module.tabula.project.ProjectInfo.inherit方法的典型用法代码示例。如果您正苦于以下问题:Java ProjectInfo.inherit方法的具体用法?Java ProjectInfo.inherit怎么用?Java ProjectInfo.inherit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在me.ichun.mods.ichunutil.common.module.tabula.project.ProjectInfo的用法示例。


在下文中一共展示了ProjectInfo.inherit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: switchState

import me.ichun.mods.ichunutil.common.module.tabula.project.ProjectInfo; //导入方法依赖的package包/类
public void switchState(String projIdent, boolean undo)//undo/redo
{
    for(int k = 0; k < projects.size(); k++)
    {
        ProjectInfo proj = projects.get(k);
        if(proj.identifier.equals(projIdent))
        {
            String state = proj.getAsJson();
            for(int i = 0; i < proj.states.size(); i++)
            {
                String storedState = proj.states.get(i);
                if(storedState.equals(state))
                {
                    if(undo && i == 0 || !undo && i == proj.states.size() - 1)//you can't undo when you're the first state or redo when you're the final state
                    {
                        return;
                    }
                    String wantedState = proj.states.get(undo ? i - 1 : i + 1);
                    ProjectInfo newProj = ((new Gson()).fromJson(wantedState, ProjectInfo.class));
                    newProj.inherit(proj);
                    projects.remove(k);
                    projects.add(k, newProj);

                    newProj.switchState = i;

                    streamProject(newProj);

                    break;
                }
            }
        }
    }
}
 
开发者ID:iChun,项目名称:Tabula,代码行数:34,代码来源:Mainframe.java

示例2: overrideProject

import me.ichun.mods.ichunutil.common.module.tabula.project.ProjectInfo; //导入方法依赖的package包/类
public void overrideProject(String projectIdent, String projectJson, BufferedImage image) // replaces an entire project with this, or creates a new one.
{
    ProjectInfo project = ((new Gson()).fromJson(projectJson, ProjectInfo.class));

    project.repair();

    BufferedImage oriImage = null;

    boolean flag = true;
    if(!projectIdent.isEmpty())
    {
        for(int i = 0; i < projects.size(); i++)
        {
            ProjectInfo proj = projects.get(i);
            if(proj.identifier.equals(projectIdent))
            {
                oriImage = proj.bufferedTexture;
                int txW = project.textureWidth;
                int txH = project.textureHeight;
                project.inherit(proj);
                project.textureWidth = txW;
                project.textureHeight = txH;
                project.bufferedTexture = image;
                projects.remove(i);
                projects.add(i, project);
                flag = false;
                break;
            }
        }
    }

    if(flag)
    {
        project.identifier = RandomStringUtils.randomAscii(IDENTIFIER_LENGTH);

        projects.add(project);

        project.bufferedTexture = image;
    }

    streamProject(project);

    if(!IOUtil.areBufferedImagesEqual(oriImage, project.bufferedTexture))
    {
        streamProjectTexture(project.identifier, project.bufferedTexture);
    }
}
 
开发者ID:iChun,项目名称:Tabula,代码行数:48,代码来源:Mainframe.java


注:本文中的me.ichun.mods.ichunutil.common.module.tabula.project.ProjectInfo.inherit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。