Initialize() 공개 메소드

public Initialize ( string tooltipText, bool udpReliable, bool isPlayer, bool destroyOnDisconnect, bool teleportToInitialPosition, System udpReliableChanged, System isPlayerChanged, System destroyOnDisconnectChanged, System teleportToInitialPositionsChanged ) : void
tooltipText string
udpReliable bool
isPlayer bool
destroyOnDisconnect bool
teleportToInitialPosition bool
udpReliableChanged System
isPlayerChanged System
destroyOnDisconnectChanged System
teleportToInitialPositionsChanged System
리턴 void
	void OnEnable()
	{
		//lerpFoldout = new AnimBool(true);
		//authoritativeFoldout = new AnimBool(true);
		networkingFoldout = new AnimBool(true);
		easyControls = new AnimBool(true);
		easyControls.target = true;

		_editorStyle = new GUIStyle();
		_editorStyle.normal.textColor = Color.white;
		_editorStyle.fontStyle = FontStyle.Bold;
		_editorStyle.alignment = TextAnchor.UpperCenter;

		Texture2D btnUp = Resources.Load<Texture2D>("HoverIdle");

		// TODO:  Implement
		//Texture2D btnDwn = Resources.Load<Texture2D>("HoverOver");
		//Texture2D btnIcon = Resources.Load<Texture2D>("ForgeAnvil");

		_editorButtons = new List<ForgeEditorDisplayButton>();

		ForgeButtonStyle buttonStyle = new ForgeButtonStyle("Server Is Authority", btnUp, btnUp, null, 75);
		//ForgeSubmitButtonStyle submitButtonStyle = new ForgeSubmitButtonStyle(() =>
		//{
		//	Debug.Log("Submit success");
		//}, "Toggle");

		ServerAuthorityButton serverAuthorityButton = new ServerAuthorityButton(buttonStyle);
		serverAuthorityButton.Initialize(Target.serverIsAuthority, Target.clientSidePrediction, string.Empty,
		(authorityValue)=>
		{
			Target.serverIsAuthority = authorityValue;
		},
		(clientSidePredictionValue)=>
		{
			Target.clientSidePrediction = clientSidePredictionValue;
		});

		_editorButtons.Add(serverAuthorityButton);

		buttonStyle = new ForgeButtonStyle("Networking Throttle", btnUp, btnUp, null, 100);

		NetworkThrottleButton networkingThrottleButton = new NetworkThrottleButton(buttonStyle);
		networkingThrottleButton.Initialize(Target.networkTimeDelay, "This controls how long (in seconds) to wait before updating across the network (priority can be emulated here), this includes [NetSync] vars.",
		(throttle)=>
		{
			Target.networkTimeDelay = throttle;
		});

		_editorButtons.Add(networkingThrottleButton);

		buttonStyle = new ForgeButtonStyle("Interpolation", btnUp, btnUp, null, 175);

		InterpolationButton interpolationButton = new InterpolationButton(buttonStyle);
		interpolationButton.Initialize(Target.interpolateFloatingValues, Target.lerpT, Target.lerpStopOffset, Target.lerpAngleStopOffset, "",
		(interpolation)=>
		{
			Target.interpolateFloatingValues = interpolation;
		},
		(lerpSpeed)=>
		{
			Target.lerpT = lerpSpeed;
		},
		(distanceStop)=>
		{
			Target.lerpStopOffset = distanceStop;
		},
		(angleStop)=>
		{
			Target.lerpAngleStopOffset = angleStop;
		});

		_editorButtons.Add(interpolationButton);

		buttonStyle = new ForgeButtonStyle("Easy Controls", btnUp, btnUp, null, 150);

		EasyControlsButton easyControlsButton = new EasyControlsButton(buttonStyle);
		easyControlsButton.Initialize(Target.lerpPosition,
			Target.serializePosition,
			Target.lerpRotation, 
			Target.serializeRotation,
			Target.lerpScale,
			Target.serializeScale,
		(lerpPositionChanged) =>
		{
			Target.lerpPosition = lerpPositionChanged;
		},
		(serializePositionChanged) =>
		{
			Target.serializePosition = serializePositionChanged;
		},
		(lerpRotationChanged) =>
		{
			Target.lerpRotation = lerpRotationChanged;
		},
		(serializeRotationChanged) =>
		{
			Target.serializeRotation = serializeRotationChanged;
		},
		(lerpScaleChanged) =>
		{
			Target.lerpScale = lerpScaleChanged;
		},
		(serializeScaleChanged) =>
		{
			Target.serializeScale = serializeScaleChanged;
		});

		_editorButtons.Add(easyControlsButton);

		buttonStyle = new ForgeButtonStyle("Miscellanous", btnUp, btnUp, null, 200);

		MiscellaneousButton miscButton = new MiscellaneousButton(buttonStyle);
		miscButton.Initialize("For things that constantly update like position and rotation you would normally not turn on reliable.",
			Target.isReliable,
			Target.isPlayer,
			Target.destroyOnDisconnect,
			Target.teleportToInitialPositions,
		(udpReliable)=>
		{
			Target.isReliable = udpReliable;
		},
		(isPlayer)=>
		{
			Target.isPlayer = isPlayer;
		},
		(destroyOnDisconnect)=>
		{
			Target.destroyOnDisconnect = destroyOnDisconnect;
		},
		(teleportToInitialPosition)=>
		{
			Target.teleportToInitialPositions = teleportToInitialPosition;
		});

		_editorButtons.Add(miscButton);

		//lerpFoldout.valueChanged.AddListener(Repaint);
		//networkingFoldout.valueChanged.AddListener(Repaint);
		//easyControls.valueChanged.AddListener(Repaint);
	}
    protected override void OnEnable()
    {
        base.OnEnable();

        //lerpFoldout = new AnimBool(true);
        //authoritativeFoldout = new AnimBool(true);
        networkingFoldout   = new AnimBool(false);
        easyControls        = new AnimBool(true);
        easyControls.target = true;

        _editorStyle = new GUIStyle();
        _editorStyle.normal.textColor = Color.white;
        _editorStyle.fontStyle        = FontStyle.Bold;
        _editorStyle.alignment        = TextAnchor.UpperCenter;

        Texture2D btnUp = Resources.Load <Texture2D>("HoverIdle");

        // TODO:  Implement
        //Texture2D btnDwn = Resources.Load<Texture2D>("HoverOver");
        //Texture2D btnIcon = Resources.Load<Texture2D>("ForgeAnvil");

        _editorButtons = new List <ForgeEditorDisplayButton>();

        ForgeButtonStyle buttonStyle = new ForgeButtonStyle("Server Is Authority", btnUp, btnUp, null, 75);
        //ForgeSubmitButtonStyle submitButtonStyle = new ForgeSubmitButtonStyle(() =>
        //{
        //	Debug.Log("Submit success");
        //}, "Toggle");

        ServerAuthorityButton serverAuthorityButton = new ServerAuthorityButton(buttonStyle);

        serverAuthorityButton.Initialize(Target.serverIsAuthority, Target.clientSidePrediction, string.Empty,
                                         (authorityValue) =>
        {
            Target.serverIsAuthority = authorityValue;
        },
                                         (clientSidePredictionValue) =>
        {
            Target.clientSidePrediction = clientSidePredictionValue;
        });

        _editorButtons.Add(serverAuthorityButton);

        buttonStyle = new ForgeButtonStyle("Networking Throttle", btnUp, btnUp, null, 100);

        NetworkThrottleButton networkingThrottleButton = new NetworkThrottleButton(buttonStyle);

        networkingThrottleButton.Initialize(Target.networkTimeDelay, "This controls how long (in seconds) to wait before updating across the network (priority can be emulated here), this includes [NetSync] vars.",
                                            (throttle) =>
        {
            Target.networkTimeDelay = throttle;
        });

        _editorButtons.Add(networkingThrottleButton);

        buttonStyle = new ForgeButtonStyle("Interpolation", btnUp, btnUp, null, 175);

        InterpolationButton interpolationButton = new InterpolationButton(buttonStyle);

        interpolationButton.Initialize(Target.interpolateFloatingValues, Target.lerpT, Target.lerpStopOffset, Target.lerpAngleStopOffset, "",
                                       (interpolation) =>
        {
            Target.interpolateFloatingValues = interpolation;
        },
                                       (lerpSpeed) =>
        {
            Target.lerpT = lerpSpeed;
        },
                                       (distanceStop) =>
        {
            Target.lerpStopOffset = distanceStop;
        },
                                       (angleStop) =>
        {
            Target.lerpAngleStopOffset = angleStop;
        });

        _editorButtons.Add(interpolationButton);

        buttonStyle = new ForgeButtonStyle("Easy Controls", btnUp, btnUp, null, 150);

        EasyControlsButton easyControlsButton = new EasyControlsButton(buttonStyle);

        easyControlsButton.Initialize(Target.lerpPosition,
                                      Target.serializePosition,
                                      Target.lerpRotation,
                                      Target.serializeRotation,
                                      Target.lerpScale,
                                      Target.serializeScale,
                                      (lerpPositionChanged) =>
        {
            Target.lerpPosition = lerpPositionChanged;
        },
                                      (serializePositionChanged) =>
        {
            Target.serializePosition = serializePositionChanged;
        },
                                      (lerpRotationChanged) =>
        {
            Target.lerpRotation = lerpRotationChanged;
        },
                                      (serializeRotationChanged) =>
        {
            Target.serializeRotation = serializeRotationChanged;
        },
                                      (lerpScaleChanged) =>
        {
            Target.lerpScale = lerpScaleChanged;
        },
                                      (serializeScaleChanged) =>
        {
            Target.serializeScale = serializeScaleChanged;
        }, 0, 0, 0);

        _editorButtons.Add(easyControlsButton);

        buttonStyle = new ForgeButtonStyle("Miscellaneous", btnUp, btnUp, null, 200);

        MiscellaneousButton miscButton = new MiscellaneousButton(buttonStyle);

        miscButton.Initialize("For things that constantly update like position and rotation you would normally not turn on reliable.",
                              Target.isReliable,
                              Target.isPlayer,
                              Target.destroyOnDisconnect,
                              Target.teleportToInitialPositions,
                              (udpReliable) =>
        {
            Target.isReliable = udpReliable;
        },
                              (isPlayer) =>
        {
            Target.isPlayer = isPlayer;
        },
                              (destroyOnDisconnect) =>
        {
            Target.destroyOnDisconnect = destroyOnDisconnect;
        },
                              (teleportToInitialPosition) =>
        {
            Target.teleportToInitialPositions = teleportToInitialPosition;
        });

        _editorButtons.Add(miscButton);

        //lerpFoldout.valueChanged.AddListener(Repaint);
        //networkingFoldout.valueChanged.AddListener(Repaint);
        //easyControls.valueChanged.AddListener(Repaint);
    }