/// <summary>
    /// Tells the new selected index of cutscene.
    /// </summary>
    /// <param name="cutscene"></param>
    /// <param name="selected"></param>
    public void SetSelected(CutsceneEvent cutscene, int selected)
    {
        var index = metadataDictionary[cutscene];

        SerializedInstance.FindProperty("items").GetArrayElementAtIndex(index)
        .FindPropertyRelative("selected").intValue = selected;
    }
 public void ProcessEvent(CutsceneEvent e)
 {
     // Set event description in the UI
     CutsceneEventDescription.GetComponentInChildren <Text>().text = e.Description;
     // Let the viewer set its content
     CutsceneEventViewer.GetComponent <CutsceneProcessor>().ProcessEvent(e);
 }
    private static void Open(CutsceneEvent target)
    {
        Debug.Log("opening");

        CutsceneEventEditorWindow.target = target;

        var window = EditorWindow.GetWindow <CutsceneEventEditorWindow>();

        window.Show();
    }
    private void AddToMetadataDictionary(CutsceneEvent cutscene, int index)
    {
        var remove = items[index].cutscene;

        if (remove != null)
        {
            RemoveFromMetadataDictionary(remove);
        }

        metadataDictionary.Add(cutscene, index);
    }
示例#5
0
    public void ProcessEvent(CutsceneEvent e)
    {
        ToggledParent.SetActive(true);
        BackgroundDarkener.GetComponent <CanvasRenderer>().SetAlpha(0);
        BackgroundDarkener.GetComponent <Image>().CrossFadeAlpha(.85f, 1, false);
        _event = e;
        PlaySound(e);
        string path = Path.Combine(ResourceFolder, e.ImagePath).Replace('\\', '/');

        Debug.Log("Loading a cutscene from: " + path);
        var texture = Resources.Load <Texture>(path);
        var image   = GetComponent <RawImage>();

        image.texture = texture;
        GetComponent <AspectRatioFitter>().aspectRatio = texture.width / (float)texture.height;
    }
    /// <summary>
    /// Returns the selected index of the cutscene.
    /// </summary>
    /// <param name="cutscene"></param>
    /// <returns></returns>
    public int GetSelected(CutsceneEvent cutscene)
    {
        int index;

        if (!metadataDictionary.TryGetValue(cutscene, out index))
        {
            // Create
            index = itemIndex;

            // Set
            var item = SerializedInstance.FindProperty("items").GetArrayElementAtIndex(index);
            item.FindPropertyRelative("cutscene").objectReferenceValue = cutscene;
            item.FindPropertyRelative("selected").intValue             = 0;
            SerializedInstance.FindProperty("itemIndex").intValue      = (itemIndex + 1) % ITEM_SIZE;

            // Add
            AddToMetadataDictionary(cutscene, index);
        }

        return(items[index].selected);
    }
 private void RemoveFromMetadataDictionary(CutsceneEvent cutscene)
 {
     metadataDictionary.Remove(cutscene);
 }
 /// <summary>
 /// Tells that a new cutscene event was opened.
 /// </summary>
 /// <param name="cutscene"></param>
 public void SetLastTarget(CutsceneEvent cutscene)
 {
     SerializedInstance.FindProperty("lastTarget").objectReferenceValue = cutscene;
 }
 private static void Save(CutsceneEvent target)
 {
 }