UDN
Search public documentation:

GFxAScriptToKismetJP
English Translation
中国翻译
한국어

Interested in the Unreal Engine?
Visit the Unreal Technology site.

Looking for jobs and company info?
Check out the Epic games site.

Questions about support via UDN?
Contact the UDN Staff

UE3 ホーム > ユーザーインターフェイスと HUD > 「Scaleform GFx」 > 外部インターフェイスの呼び出しを Kismet に送る方法

外部インターフェイスの呼び出しを Kismet に送る方法


概要


「Scaleform」は、テクスチャにレンダリングすることが可能であり、さらにそれをワールド内に表示することが可能であるため、Kismet を直接 ActionScript から呼び出すことができればたいへん便利です。

ActionScript 2.0 のメソッド


Flash のボタンが次のようにセットアップされているとします。

ActionScript
on (press)
{
  import flash.external.ExternalInterface;
  ExternalInterface.call("MyUnrealScriptFunction");
}

ExternalInterface の呼び出しとともに好きなだけ多く (あるいは、少なく) パラメータを渡すことができます。(例 : ExternalInterface.call("MyFunction", "Matthew", 37, true) では、string 値と integer 値、bool 値が渡されています)。この例では、何も渡されていません。単に、MyUnrealScriptFunction という関数を呼び出しています。

UnrealScript では、次のようになっているとします。

Unrealscript
class MyMoviePlayer extends GFxMoviePlayer;

//function to receive External Interface call
function MyUnrealScriptFunction()
{
  `log("###### ExternalInterface Call Received #####");
  TriggerRemoteKismetEvent('MyEvent');
}

//function to trigger a remote kismet event
function TriggerRemoteKismetEvent( name EventName )
{
  local array<SequenceObject> AllSeqEvents;
  local Sequence GameSeq;
  local int i;

  GameSeq = GetPC().WorldInfo.GetGameSequence();
  if (GameSeq != None)
  {
    // find any Level Reset events that exist
    GameSeq.FindSeqObjectsByClass(class'SeqEvent_RemoteEvent', true, AllSeqEvents);

    // activate them
    for (i = 0; i < AllSeqEvents.Length; i++)
    {
      if(SeqEvent_RemoteEvent(AllSeqEvents[i]).EventName == EventName)
      {
        SeqEvent_RemoteEvent(AllSeqEvents[i]).CheckActivate(GetPC().WorldInfo, None);
      }
    }
  }
}

レベル内に Remote Event Kismet ノードを追加して、MyEvent という名前を付けます。

さらに、そのイベントを、発生させたいものにリンクします。