50 lines
965 B
C#
50 lines
965 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class FunctionSync_Active : OneValueSyncObject
|
|
{
|
|
public void Init()
|
|
{
|
|
if (!hasInit)
|
|
{
|
|
InitDynamic("active_" + gameObject.name, CallBack, ValueType.Bool);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 显示物体
|
|
/// </summary>
|
|
public void ShowObject()
|
|
{
|
|
gameObject.SetActive(true);
|
|
mybool = true;
|
|
SendSync();
|
|
}
|
|
/// <summary>
|
|
/// 隐藏物体
|
|
/// </summary>
|
|
public void DisShowObject()
|
|
{
|
|
gameObject.SetActive(false);
|
|
mybool = false;
|
|
SendSync();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 回调
|
|
/// </summary>
|
|
/// <param name="id"></param>
|
|
public void CallBack(string id,bool isEnterRoom)
|
|
{
|
|
if(mybool)
|
|
{
|
|
gameObject.SetActive(true);
|
|
}
|
|
else
|
|
{
|
|
gameObject.SetActive(false);
|
|
}
|
|
}
|
|
}
|