flexpanel_node_get_child_hash 함수 설명

flexpanel_node_get_child_hash 함수는 flexpanel_node_get_child와 동일한 기능을 수행하지만, 자식 노드의 이름이나 이름의 해시값을 인자로 받아 사용합니다.

문법

flexpanel_node_get_child_hash(node, hash_or_name);

인자 설명

인자 타입 설명
node Flex Panel Node 자식 노드를 가져올 부모 노드
hash_or_name String or Real 찾고자 하는 자식의 이름 또는 이름의 해시값

반환값

  • Flex Panel Node

예제

// Create Event
hash = variable_get_hash("weap");

// Any Event
var _node = flexpanel_node_get_child_hash(n_root, hash);

위의 예제에서, Create 이벤트에서는 문자열 "weap"의 해시값을 가져와 변수에 저장합니다. 이후의 이벤트에서는 이 해시값을 사용하여 n_root 노드에서 "weap"이라는 이름의 자식 노드를 가져옵니다.

활용 예제

예제 1: 자식 노드의 해시값을 사용하여 접근하기

// Create Event
hash_item = variable_get_hash("item");

// 특정 이벤트에서 자식 노드 접근
var item_node = flexpanel_node_get_child_hash(parent_node, hash_item);

예제 2: 여러 자식 노드에 대한 반복 처리

// Create Event
hash_enemy = variable_get_hash("enemy");
hash_friend = variable_get_hash("friend");

// 반복문을 통해 자식 노드 접근
for (var i = 0; i < 10; i++) {
    var enemy_node = flexpanel_node_get_child_hash(parent_node, hash_enemy + string(i));
    // enemy_node에 대한 처리
}

예제 3: 해시값을 사용한 조건부 접근

// Create Event
hash_target = variable_get_hash("target");

// 특정 조건에서 자식 노드 접근
if (some_condition) {
    var target_node = flexpanel_node_get_child_hash(parent_node, hash_target);
    // target_node에 대한 처리
}

이와 같이 flexpanel_node_get_child_hash 함수를 활용하여 자식 노드에 쉽게 접근하고 다양한 상황에서 사용할 수 있습니다.