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
<?xml version="1.0" encoding="utf-8"?> | |
<paths xmlns:android="http://schemas.android.com/apk/res/android"> | |
<files-path name="share_name" path="directory_name/"/> | |
</paths> |
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
<provider | |
android:name="android.support.v4.content.FileProvider" | |
android:authorities="${applicationId}.fileprovider" | |
android:exported="false" | |
android:grantUriPermissions="true" | |
> | |
<meta-data | |
android:name="android.support.FILE_PROVIDER_PATHS" | |
android:resource="@xml/file_paths" | |
/> |
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
// 仮に .../files/directory_name/hoge.txt を共有する場合 | |
String shareFilePath = getFilesDir() + "/hoge.txt"; | |
File shareFile = new File(shareFilePath); | |
Uri shareUri = FileProvider.getUriForFile( | |
getContext(), | |
BuildConfig.APPLICATION_ID + ".fileprovider", | |
shareFile | |
); |
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
// 仮に .../files/directory_name/hoge.txt を共有する場合 | |
String shareFilePath = getFilesDir() + "/hoge.txt"; | |
File shareFile = new File(shareFilePath); | |
Uri shareUri = Uri.fromFile(shareFile); |
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
using UnityEngine; | |
public class CompositeTest : MonoBehaviour | |
{ | |
private GameItemDirectory itemDirectory = new GameItemDirectory("アイテム"); | |
private GameItemDirectory consumptionItemDirectory = new GameItemDirectory("消費アイテム"); | |
private GameItemDirectory equippedItemDirectory = new GameItemDirectory("装備アイテム"); | |
void Start () { | |
setupDirectories(); |
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
using UnityEngine; | |
public class GameItemFile : Entry | |
{ | |
// コンストラクタ | |
public GameItemFile(string name) | |
{ | |
this.name = name; | |
} |
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
using UnityEngine; | |
using System.Collections.Generic; | |
public class GameItemDirectory : Entry | |
{ | |
// 要素のリスト | |
private List<Entry> directory = new List<Entry>(); | |
// コンストラクタ | |
public GameItemDirectory(string name) |
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
public abstract class Entry | |
{ | |
protected string name = ""; | |
public string Name | |
{ | |
get | |
{ | |
return this.name; | |
} | |
} |