Пример #1
0
    /// <summary>
    /// キャラ画像の設定
    /// </summary>
    /// <param name="unitID"></param>
    /// <param name="assetLoadCharaImageList"></param>
    public void SetUpCharImage(uint storyCharaID, List <AssetLoadStoryViewResource> assetLoadCharaImageList)
    {
        //-------------------------------------------
        // ユニット画像の設定
        //-------------------------------------------
        if (storyCharaID > 0)
        {
            AssetLoadStoryViewResource assetResource = assetLoadCharaImageList.Find(v => v.m_fix_id == storyCharaID &&
                                                                                    v.Type == AssetLoadStoryViewResource.ResourceType.CHARA);
            Context.CharaTexture      = (assetResource != null) ? assetResource.GetTexture() : null;
            Context.CharaTexture_mask = (assetResource != null) ? assetResource.GetTextureMask() : null;

            // UVの設定
            if (assetResource != null && assetResource.CharaMasterData != null)
            {
                MasterDataStoryChara charaMaster = assetResource.CharaMasterData;

                Context.CharaUV = new Rect(charaMaster.img_offset_x * 0.001f
                                           , charaMaster.img_offset_y * 0.001f
                                           , charaMaster.img_tiling * 0.001f
                                           , charaMaster.img_tiling * 0.001f);
            }
            else
            {
                Context.CharaUV = new Rect(0, 0, 1, 1);
            }
        }
    }
    void SetupStoryCharaMaster(int index)
    {
        //--------------------------------
        // アクセス番号決定
        //--------------------------------
        if (index >= m_StoryCharaMasterArray.Length)
        {
            index = 0;
        }
        if (index < 0)
        {
            index = m_StoryCharaMasterArray.Length - 1;
        }

        MasterDataStoryChara storyCharaMaster = m_StoryCharaMasterArray[index];

        m_CurrentStoryCharaMaster = storyCharaMaster;
        m_Index = index;

        m_DebugPartyOffset.CheckAdjustUV();

        m_CharaResource = new AssetLoadStoryViewResource();

        m_DebugPartyOffset.NameText            = "MasterDataStoryChara";
        m_DebugPartyOffset.m_IdInputField.text = storyCharaMaster.fix_id.ToString();
        m_DebugPartyOffset.SetupUV(m_OffsetXArray[m_Index]
                                   , m_OffsetYArray[m_Index]
                                   , m_TilingArray[m_Index]
                                   );
        m_DebugPartyOffset.SetupAdjustUV(storyCharaMaster.img_offset_x * 0.001f, storyCharaMaster.img_offset_y * 0.001f, storyCharaMaster.img_tiling * 0.001f);
        m_DebugPartyOffset.CheckAdjustUV();

        m_CharaResource.SetStoryCharaId(storyCharaMaster.fix_id);
        StartCoroutine(LoopAssetLoad(() =>
        {
            m_DebugPartyOffset.ThirdUnitMaterial.SetTexture("_MainTex", m_CharaResource.GetTexture());
            SetUpUVParam();
        }));
    }