Unity.ts - インターフェイス

Web ページでは、まず unitySample という名前空間を作成します。この名前空間には、いくつかのインターフェイスと class が含まれています。このセクションは unitySample のインターフェイスをカバーします。

IGameDataCube

IGameDataCube インターフェイスは、ゲームデータストリームからの情報を適切にソートします。通常は、データを配列として受けとり、オブジェクトに関連する情報を簡単にアクセスできるように、このインターフェイスに変換します。

name
オブジェクト名
leader
オブジェクトが leader かどうかを示すブール値
popularity
オブジェクトの現在の popularity 値
mat
オブジェクトの現在の行列
selected
オブジェクトが選択されているかどうかを示すブール値
popText
文字列に変換された Popularity 値。
color
オブジェクトの現在の色
    // Conversion from Json data into structure for a specific cube
    export interface IGameDataCube {
        name: string;
        popularity: number;
        mat: IUnityMatrix4x4;
        selected?: boolean;
        popText?: string;
        color: IUnityColor;
    }

ICubePopularity

ICubePopularity インターフェイスは、popularity に関連する情報を適切にソートします。

name
オブジェクト名
popularity
オブジェクトの popularity 値
    // Conversion from Json data into structure for the popularity
    export interface ICubePopularity {
        name: string;
        popularity: number;
    }

ICubePopularities

ICubePopularities インターフェイスは、popularity に関連する情報を適切にソートし、配列に配置します。同時に複数の popularity が存在する場合に使用します。

cubes
ICubePopularity 値のリスト。
    // Conversion from Json data into array of structure for the popularity
    export interface ICubePopularities {
        cubes: ICubePopularity[];
    }

IGameData

IGameData インターフェイスは、ゲームデータからの情報を適切にソートします。オブジェクトと射影行列 (projection view matrix) からの情報を同時に送信するために使用します。

cubes
IGameDataCube インターフェイスを使用しているそれぞれのオブジェクトの情報
MatProjView
射影行列 (WebGL で役立ちます)
    // Conversion from Json data into structure for the entire data
    export interface IGameData {
        cubes: IGameDataCube[];
        MatProjView: IUnityMatrix4x4;
        camera: number;
        scene: number;
    }

IGameChangeColorAnnotation

IGameChangeColorAnnotation インターフェイスは、キューブの色が変更されたときに、アノテーションからの情報を適切にソートします。

name
色が変更された Cube の名前。
color
Cube に適用される新しい色
    // Conversion from Json data into structure for the entire annotation
    export interface IGameChangeColorAnnotation {
        name: string;
        color: any;
    }

IGameChangeColorAnnotationList

IGameChangeColorAnnotationList インターフェイスは、キューブの色が変更されたときに送信される通知の情報をにソートし、配列に配置します。同時に複数の色変更情報が利用可能な場合に使用します。

colorList
IGameChangeColorAnnotation 値のリスト。
    // Annotation list
    export interface IGameChangeColorAnnotationList {
        colorList: IGameChangeColorAnnotation[];
    }