Skip to content

Latest commit

 

History

History
189 lines (124 loc) · 3.98 KB

File metadata and controls

189 lines (124 loc) · 3.98 KB

Class: SentGiftComponent

Types

<ComponentProps>

See <ComponentProps>


<SentGiftComponentProps>

A portion of the configuration object to pass to the SentGiftComponent constructor.

type Gift = null | {
  data: number[];
  messageSizeInBytes: number;
  hash: number;
  chunkVersioning: number[];
};

type SentGiftTag = null | {
  from: number;
  to: number;
};

type SentGiftComponentPropsV1 = {
  receiverName?: string | undefined;
  senderName?: string | undefined;
  gifts?: Gift[] | undefined;
  senderTag?: SentGiftTag | undefined;
};

type SentGiftComponentProps = SentGiftComponentPropsV1;

Since v1

  • receiverName (optional, default '') <string>
  • senderName (optional, default '') <string>
  • gifts (optional, default []) <Array<Gift>>
  • senderTag (optional, default null) <SentGiftTag>

Constructors

new SentGiftComponent(props)

Creates a versioned SentGift component.

import { SentGiftComponent } from 'att-string-transcoder';

const componentVersion = 1;
const component = new SentGiftComponent({ version: componentVersion });

SentGiftComponent.fromBinary(reader, version)

See Component.fromBinary(reader, version)

Properties

Note that the following properties are sorted in order of appearance when decoding component binary data.

hash

See Component.hash


name

See Component.name


version

See Component.version


receiverName

Name of the player intended as the receiver of the prefab this component is attached to.

  • Since: v1
  • <string>
import { SentGiftComponent } from 'att-string-transcoder';

const componentVersion = 1;
const component = new SentGiftComponent({ version: componentVersion });

const receiverName = component.receiverName;
// `receiverName` is `''`

senderName

Name of the player intended as the sender of the prefab this component is attached to. This name will be displayed as a label on a gift box prefab.

  • Since: v1
  • <string>
import { SentGiftComponent } from 'att-string-transcoder';

const componentVersion = 1;
const component = new SentGiftComponent({ version: componentVersion });

const senderName = component.senderName;
// `senderName` is `''`

gifts

Array of gifts, which are prefab save strings.

  • Since: v1
  • <Array<Gift>>
import { SentGiftComponent } from 'att-string-transcoder';

const componentVersion = 1;
const component = new SentGiftComponent({ version: componentVersion });

const gifts = component.gifts;
// `gifts` is `[]`

senderTag

  • Since: v3
  • <SentGiftTag>
import { SentGiftComponent } from 'att-string-transcoder';

const componentVersion = 1;
const component = new SentGiftComponent({ version: componentVersion });

const senderTag = component.senderTag;
// `senderTag` is `null`

Methods

toBinary(version?)

See Component.toBinary(version?)


write(writer, version?)

See Component.write(writer, version?)