Ejemplo n.º 1
0
$dialogData06->set_text("Anda memilih Sate. Sate apa yang Anda sukai?");
$dialogData06->set_opt(0, $dialogOption11);
$dialogData06->set_opt(1, $dialogOption12);
$dialogData06->set_opt(2, $dialogOption13);
$dialogData06->set_opt(3, $dialogOption14);
$dialogData07 = new DialogData();
$dialogData07->set_id(7);
$dialogData07->set_tipe(0);
$dialogData07->set_text("Soto Anda telah terhidang. Selamat menikmati.");
$dialogData07->set_opt(0, $dialogOption15);
$dialogData08 = new DialogData();
$dialogData08->set_id(8);
$dialogData08->set_tipe(0);
$dialogData08->set_text("Sate Anda telah terhidang. Selamat menikmati.");
$dialogData08->set_opt(0, $dialogOption16);
$dialogTree02 = new DialogTree();
//$dialogTree02->set_dialogs(array($dialogData04, $dialogData05, $dialogData06, $dialogData07, $dialogData08));
$dialogTree02->set_dialogs(0, $dialogData04);
$dialogTree02->set_dialogs(1, $dialogData05);
$dialogTree02->set_dialogs(2, $dialogData06);
$dialogTree02->set_dialogs(3, $dialogData07);
$dialogTree02->set_dialogs(4, $dialogData08);
$dialogTree02->set_currentDialog(0);
// QUEST
$questResult01 = new QuestResult();
$questResult01->set_key('item');
$questResult01->set_val('0');
$questResult02 = new QuestResult();
$questResult02->set_key('doku');
$questResult02->set_val('300');
$Activity01 = new Activity();
Ejemplo n.º 2
0
$dialogData01->set_id(1);
$dialogData01->set_tipe(DIALOG);
$dialogData01->set_text("Anda siapa?");
$dialogData01->set_opt(0, $dialogOption01);
$dialogData01->set_opt(1, $dialogOption02);
$dialogData02 = new DialogData();
$dialogData02->set_id(2);
$dialogData02->set_tipe(DIALOG);
$dialogData02->set_text("Kambing Guling!!!");
$dialogData02->set_opt(0, $dialogOption03);
$dialogData03 = new DialogData();
$dialogData03->set_id(3);
$dialogData03->set_tipe(DIALOG);
$dialogData03->set_text("Ayam kampu** ?");
$dialogData03->set_opt(0, $dialogOption04);
$dialogTree01 = new DialogTree();
$dialogTree01->set_dialogs(0, $dialogData01);
$dialogTree01->set_dialogs(1, $dialogData02);
$dialogTree01->set_dialogs(2, $dialogData03);
$dialogTree01->set_currentDialog(1);
$serialized_string = $dialogTree01->SerializeToString();
$text = print_r($serialized_string, true);
print $text;
/*
$filename = 'test.txt';
$somecontent = $text;

if (is_writable($filename)) {
    if (!$handle = fopen($filename, 'a')) {
         echo "Cannot open file ($filename)";
         exit;
Ejemplo n.º 3
0
function asset_admin_test_proto()
{
    define("DIALOG", 1);
    require_once 'libraries/protocolbuf/message/pb_message.php';
    require_once 'modules/002_asset_management/protocol_buffer/pb_proto_DialogTree.php';
    $dialogOption01 = new DialogOption();
    $dialogOption01->set_nextDialog(2);
    $dialogOption01->set_text('Kambing');
    $dialogOption02 = new DialogOption();
    $dialogOption02->set_nextDialog(3);
    $dialogOption02->set_text('Ayam');
    $dialogOption03 = new DialogOption();
    $dialogOption03->set_nextDialog(0);
    $dialogOption03->set_text('OK. Guling2 aja semau lo...');
    $dialogOption04 = new DialogOption();
    $dialogOption04->set_nextDialog(0);
    $dialogOption04->set_text('OK deh, ayam jg ga apa2...');
    $dialogData01 = new DialogData();
    $dialogData01->set_id(1);
    $dialogData01->set_DialogType(DIALOG);
    $dialogData01->set_text("Anda siapa?");
    $dialogData01->set_OptionList(0, $dialogOption01);
    $dialogData01->set_OptionList(1, $dialogOption02);
    //	$dialogData01->values["4"] = array($dialogOption01, $dialogOption02);
    $dialogData02 = new DialogData();
    $dialogData02->set_id(2);
    $dialogData02->set_DialogType(DIALOG);
    $dialogData02->set_text("Kambing Guling!!!");
    $dialogData02->set_OptionList(0, $dialogOption03);
    $dialogData03 = new DialogData();
    $dialogData03->set_id(3);
    $dialogData03->set_DialogType(DIALOG);
    $dialogData03->set_text("Ayam kampu** ?");
    $dialogData03->set_OptionList(0, $dialogOption04);
    $dialogTree01 = new DialogTree();
    $dialogTree01->set_Dialogs(0, $dialogData01);
    $dialogTree01->set_Dialogs(1, $dialogData02);
    $dialogTree01->set_Dialogs(2, $dialogData03);
    //	$dialogTree01->set_currentDialog(1);
    //	return print_r($dialogTree01);exit;
    //	return "<pre>" . print_r($dialogTree01) . "<pre>";
    $serialized_string = $dialogTree01->SerializeToString();
    $text = print_r($serialized_string, true);
    return $text;
}