This file contains hidden or 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
// ドラッグして移動されるオブジェクトAを受け取るオブジェクトBにアタッチされるべきコンポーネント | |
public class ReceiverComponentB: MonoBehaviour, IDropReceiver { | |
public void OnOverlappingCorrespondingSenderChange(GameObject senderObject) { | |
// このオブジェクトがDraggedComponentAを持つ別のオブジェクトと重なった/重ならなくなったときに呼ばれる | |
// 色替えなどをする | |
} | |
public void OnDrop(GameObject senderObject) { | |
// このオブジェクトがDraggedComponentAを持つ別のオブジェクトと重なったままドロップされたときに呼ばれる | |
// 各種処理をする | |
} |
This file contains hidden or 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
// ドラッグして移動されるオブジェクトAに、DragDropSenderと一緒にアタッチされるべきコンポーネント | |
public class DraggedComponentA: MonoBehaviour, ISenderComponent { | |
public void OnBeginDrag() { | |
// ドラッグしはじめでこのメソッドがDragDropSenderから呼ばれる | |
// 色変えなどをする | |
} | |
public bool IsCorrespondingObject(GameObject obj) { | |
// このオブジェクトがIDropReceiverを持つ別のオブジェクトと重なったときに呼ばれる | |
// 対応するコンポーネントBであればtrueを返す |
This file contains hidden or 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 interface IDropSender { | |
void OnBeginDrag(); | |
bool IsCorrespondingObject(GameObject obj); | |
void OnOverlappingCorrespondingReceiverChange(GameObject receiverObject); | |
void OnDrop(GameObject receiverObject); | |
} | |
public interface IDropReceiver { | |
void OnOverlappingCorrespondingSenderChange(GameObject senderObject); | |
void OnDrop(GameObject senderObject); |
This file contains hidden or 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
// 受け手オブジェクトB/Dにアタッチされる何かが継承すべきinterface | |
public interface IDropReceptor { | |
bool ReceiveDrop(GameObject obj); | |
} | |
// ドロップされるオブジェクトA/Cのコンポーネントのドロップ処理 | |
public class ComponentA: MonoBehaviour { | |
// 中略 | |
public void OnEndDrag(PointerEventData eventData) |
This file contains hidden or 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 class CommandWindowManager: MonoBehaviour { | |
public class CreateWindow(Array<(string, Action)>) { | |
// コマンドボタンの作成 | |
} | |
} | |
public class BattleMain: MonoBehabiour { | |
void CreateCommandWindow() { | |
commandWindowManager.CreateWindow(new Array<(string, Action)> { | |
( |
This file contains hidden or 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
Color color = colorType switch { | |
UNIT_COLOR.DEFAULT => new Color(1.0f, 1.0f, 1.0f, 1.0f), | |
UNIT_COLOR.ACTIVE => new Color(1.0f, 1.0f, 1.0f, 1.0f), | |
UNIT_COLOR.CANNOT_SELECT => new Color(1.0f, 1.0f, 1.0f, 1.0f), | |
UNIT_COLOR.EFFECTIVE => new Color(1.0f, 1.0f, 1.0f, 1.0f), | |
_ => throw new InvalidOperationException() | |
}; |
This file contains hidden or 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
_objUnitColorTop = Enumerable.Range(0, 3).Select(y => Enumerable.Range(0, 6).Select(x => { | |
var obj = Instantiate("PrefabName"); | |
// obj.transform.parent = などの処理 | |
return obj; | |
}).ToArray()).ToArray(); |
This file contains hidden or 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 class BattleMain: MonoBehaviour { | |
public event EventHandler<List<UnitInfo>> UnitInfoUpdateHandler; | |
public SomeBattleProcess() { | |
// ~~~~何らかの戦闘処理でUnitInfoのリストが更新 | |
UnitInfoUpdateHandler(this, this.unitInfoList); | |
} | |
} | |
//////////////////////////////// |
This file contains hidden or 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 System.Linq; | |
using Monad; | |
using Monad.Extensions; | |
namespace BuildCiv.Model.CardDifinition | |
{ | |
public readonly struct Barter : IPlayable | |
{ | |
public int CivilCost => 1; |
This file contains hidden or 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 System; | |
namespace Monad.Extensions | |
{ | |
public interface ContState<TState, TValue> : Cont<Unit, State<TState, TValue>> { } | |
internal readonly struct PureContState<TState, TValue> : ContState<TState, TValue> | |
{ | |
readonly Func<Func<State<TState, TValue>, Unit>, Unit> function; | |
internal PureContState(Func<Func<State<TState, TValue>, Unit>, Unit> function) => this.function = function; |
NewerOlder