Example #1
0
    void OnRecording(bool isRecording)
    {
        activeScenesTimeline = GetActiveScenesTimeline();
        int selectedAvatarID = charactersManager.selectedCharacter.data.id;

        if (isRecording)
        {
            RemoveLaterKeyFramesFor(selectedAvatarID);
            ResetPlayedKeyframes();
        }

        Character    character = World.Instance.charactersManager.selectedCharacter;
        KeyframeBase keyframe  = GetNewKeyframeAvatar(character);

        keyframe.avatar.action     = character.actions.action;
        keyframe.avatar.expression = character.customizer.expression;

        if (keyframe == null)
        {
            return;
        }
        AddKeyframe(keyframe);


        //foreach (Character character in World.Instance.scenesManager.sceneActive.characters)
        //{
        //    KeyframeBase keyframe = GetNewKeyframeAvatar(character);
        //    if (keyframe == null)
        //        return;
        //    AddKeyframe(keyframe);
        //}
        Events.OnTimelineUpdated();
    }
Example #2
0
    void SetActiveKeyFrame(KeyframeBase keyFrame)
    {
        if (keyFrame.avatar != null)
        {
            KeyframeAvatar keyframeAvatar = keyFrame.avatar;
            int            avatarID       = keyFrame.avatar.avatarID;
            string         action         = keyFrame.avatar.action;
            string         expression     = keyFrame.avatar.expression;
            string         chat           = keyFrame.avatar.chat;
            Vector3        moveTo         = keyFrame.moveTo;
            Vector3        pos            = keyFrame.pos;

            print("___avatar id: " + keyFrame.avatar.avatarID + " timer " + timer + " moveTO:" + moveTo);

            if (chat != null && chat.Length > 0)
            {
                uiTimeline.GetComponent <UIChatManager>().OnCharacterSay(avatarID, chat);
            }
            else
            if (moveTo != Vector3.zero)
            {
                charactersManager.MoveCharacter(avatarID, moveTo);
            }
            else
            {
                charactersManager.PositionateCharacter(avatarID, pos);
                charactersManager.ChangeExpression(avatarID, expression);
                charactersManager.CharacterAction(avatarID, action);
            }
        }
    }
Example #3
0
 public void Init(UITimelineScreen _uiTimelineScreen, KeyframeBase data, Vector2 offset, float separation)
 {
     deleteIcon.SetActive(false);
     this.uiTimelineScreen = _uiTimelineScreen;
     this.data             = data;
     //field.text = data.time.ToString();
     transform.localPosition = offset + new Vector2((data.time * separation), 0);
 }
Example #4
0
    void AddKeyFrameNewCharacter(Character character)
    {
        KeyframeBase keyframe = GetNewKeyframeAvatar(character);

        if (keyframe == null)
        {
            return;
        }
        keyframe.avatar.action     = character.actions.action;
        keyframe.avatar.expression = "norm";
        AddKeyframe(keyframe);
    }
Example #5
0
    void AddKeyFrameExpression(Character character, string value)
    {
        KeyframeBase keyframe = GetNewKeyframeAvatar(character);

        if (keyframe.avatar == null)
        {
            return;
        }
        keyframe.avatar.expression = value;
        keyframe.avatar.action     = character.actions.action;
        AddKeyframe(keyframe);
    }
Example #6
0
    public void ActiveKeyframe(KeyframeBase data)
    {
        foreach (TimelineKeyframe tlk in timelineKeyframes)
        {
            tlk.Reset();
        }
        Vector2 pos = offset + new Vector2((data.time * separation), 0);

        timelineMarker.SetX(pos.x);
        timeline.JumpTo(data.time);
        UpdateField();
    }
Example #7
0
    void OnCharacterSay(int characterID, string value)
    {
        Character    character = World.Instance.charactersManager.GetCharacter(characterID);
        KeyframeBase keyframe  = GetNewKeyframeAvatar(character);

        if (keyframe.avatar == null)
        {
            return;
        }
        keyframe.avatar.chat       = value;
        keyframe.avatar.action     = character.actions.action;
        keyframe.avatar.expression = character.customizer.expression;
        AddKeyframe(keyframe);
    }
Example #8
0
    void AddKeyFrameMove(Character character, Vector3 moveTo)
    {
        KeyframeBase keyframe = GetNewKeyframeAvatar(character);

        if (keyframe == null)
        {
            return;
        }
        keyframe.moveTo            = moveTo;
        keyframe.avatar.expression = character.customizer.expression;
        keyframe.avatar.action     = character.actions.action;
        print("AddKeyFrameMove " + character.actions.action);
        AddKeyframe(keyframe);
    }
Example #9
0
 bool isNewDrawableKeyFrame(KeyframeBase newKeyframeToCkeck)
 {
     if (newKeyframeToCkeck.moveTo != Vector3.zero
         ||
         ((lastKeyFrameAdded != null && lastKeyFrameAdded.avatar.action != newKeyframeToCkeck.avatar.action) ||
          (lastKeyFrameAdded != null && lastKeyFrameAdded.avatar.chat != newKeyframeToCkeck.avatar.chat) ||
          (lastKeyFrameAdded != null && lastKeyFrameAdded.avatar.expression != newKeyframeToCkeck.avatar.expression) &&
          (lastKeyFrameAdded != null && lastKeyFrameAdded.avatar.avatarID == newKeyframeToCkeck.avatar.avatarID))
         )
     {
         lastKeyFrameAdded = newKeyframeToCkeck;
         return(true);
     }
     return(false);
 }
Example #10
0
    KeyframeBase GetNewKeyframeAvatar(Character character)
    {
        //RemoveLaterKeyFramesFor (character.id);
        KeyframeBase keyframe = new KeyframeBase();

        keyframe.time = GetRoundedTimer(uiTimeline.timer);

        KeyframeAvatar keyframeAvatar = new KeyframeAvatar();

        keyframeAvatar.avatarID   = character.data.id;
        keyframeAvatar.action     = character.actions.action.ToString();
        keyframeAvatar.expression = character.customizer.value;
        keyframe.avatar           = keyframeAvatar;

        keyframe.pos = character.transform.position;
        return(keyframe);
    }
Example #11
0
    void AddKeyframes(TimeLineCharacter timeLineCharacter)
    {
        List <KeyframeBase> keyframes        = World.Instance.timeLine.GetkeyframesOfAvatar(timeLineCharacter.data.id);
        KeyframeBase        lastkeyframeBase = null;

        foreach (KeyframeBase keyframeBase in keyframes)
        {
            if (isNewDrawableKeyFrame(keyframeBase))
            {
                TimelineKeyframe newKeyframe = Instantiate(keyframe);
                newKeyframe.transform.SetParent(timeLineCharacter.transform);
                newKeyframe.Init(this, keyframeBase, offset, separation);
                Resize(timeLineCharacter, newKeyframe.transform.localPosition.x);
                timelineKeyframes.Add(newKeyframe);
            }
            lastkeyframeBase = keyframeBase;
        }
        if (lastkeyframeBase != null)
        {
            ActiveKeyframe(lastkeyframeBase);
        }
    }
Example #12
0
    void OnCharacterReachTile(Character character)
    {
        KeyframeBase keyframe = GetNewKeyframeAvatar(character);

        if (timer == 0 && uiTimeline.state == UITimeline.states.STOPPED)
        {
            if (keyframe != null)
            {
                keyframe.pos = character.transform.position;
                RemoveLaterKeyFramesFor(character.data.id);
                AddKeyframe(keyframe);
            }
        }
        if (uiTimeline.state != UITimeline.states.RECORDING)
        {
            return;
        }
        if (keyframe == null)
        {
            return;
        }
        AddKeyframe(keyframe);
    }
Example #13
0
    void AddKeyframe(KeyframeBase _keyframe)
    {
        int idToChange = -1;
        int id         = 0;

        foreach (KeyframeBase keyFrame in activeScenesTimeline.keyframes)
        {
            if (keyFrame.avatar.avatarID == _keyframe.avatar.avatarID && keyFrame.time == _keyframe.time)
            {
                idToChange = id;
            }
            id++;
        }
        ScenesTimeline st = activeScenesTimeline;

        if (idToChange != -1 && st.keyframes.Count >= idToChange)
        {
            st.keyframes[idToChange] = _keyframe;
        }
        else
        {
            GetActiveScenesTimeline().keyframes.Add(_keyframe);
        }
    }