示例#1
0
    /// <summary>
    /// Enable
    /// </summary>
    public void OnEnable(UnityEngine.Object ObjectReference)
    {
        CurrentTarget = (PythonBase)ObjectReference;

        if (Buffer == null)
        {
            Buffer = ScriptableObject.CreateInstance <Code>();
        }

        if (CurrentTarget.InMemory)
        {
            //Load buffer from Memory
            Buffer = EditorDataBase.Instance.GetInstance(CurrentTarget.GetInstanceID());
        }

        else if (CurrentTarget.FileCreated)
        {
            //Load buffer from file
            LoadFileStream();
        }
        else
        {
            //Load buffer by default
            Buffer.Initialize();
        }
    }
示例#2
0
    private void Awake(){
        py = GetComponent<PythonBase>();
        machine.Compile(py.FilePath, Microsoft.Scripting.SourceCodeKind.Statements);
        ClassReference = machine.GetVariable(Path.GetFileNameWithoutExtension(py.FilePath));

        InvokeMethod("Awake");
    }
示例#3
0
    /// <summary>
    /// Raises the enable event.
    /// </summary>
    private void OnEnable()
    {
        Target = (PythonBase)target;

        if (editor == null)
        {
            editor = new EditorView();
        }

        editor.OnEnable(Target);

        //Repaint Action Delegate
        editor.RepaintAction += this.Repaint;

        //Set view back
        SwitchView(Target.CurrentView);

        LoadEditorPrefs();

        ColorSkinPro = !EditorGUIUtility.isProSkin ? 0 : 255;
    }