115 lines
4.0 KiB
C#
115 lines
4.0 KiB
C#
using System;
|
||
using Games.GlobeDefine;
|
||
using Games.Scene;
|
||
using UnityEngine;
|
||
using Games.LogicObj;
|
||
using GCGame.Table;
|
||
using UnityEngine.Events;
|
||
|
||
/// <summary>
|
||
/// 致盲客户端表现效果逻辑处理
|
||
/// Effect.txt 表格扩展参数说明
|
||
/// Param1 :EffectParam.txt中id值
|
||
/// EffectParam.txt 配置
|
||
/// Param2 :需要屏蔽的层
|
||
/// Param3 :亮区域的亮度值
|
||
/// Param4 :亮区域的范围
|
||
/// Param5 :是否显示名字面板
|
||
/// </summary>
|
||
public class Impact_Blind : ImpactEffectBase
|
||
{
|
||
public override EffectLogic.EffectType ImpactEffectType
|
||
{
|
||
get { return EffectLogic.EffectType.TYPE_BLIND; }
|
||
}
|
||
public override void StartEffect()
|
||
{
|
||
base.StartEffect();
|
||
Overly = true;
|
||
DisableSee();
|
||
}
|
||
|
||
public override void StopEffect()
|
||
{
|
||
base.StopEffect();
|
||
RecoverSee();
|
||
}
|
||
|
||
public void DisableSee()
|
||
{
|
||
if (objCharacter.ObjType != GameDefine_Globe.OBJ_TYPE.OBJ_MAIN_PLAYER)
|
||
return;
|
||
if (Singleton<ObjManager>.Instance.MainPlayer == null)
|
||
return;
|
||
if (Data == null)
|
||
return;
|
||
var paramid = Data.GetParamValuebyIndex(0);
|
||
var effectparam = TableManager.GetEffectParamByID(paramid, 0);
|
||
if(effectparam!=null)
|
||
{
|
||
string paramStr = "";
|
||
int paramInt = 0;
|
||
if (SceneLogic.CameraController != null)
|
||
{
|
||
paramStr = effectparam.GetParamValuebyIndex(0);
|
||
int.TryParse(paramStr, out paramInt);
|
||
SceneLogic.CameraController.RemoveLayerMask(paramInt);
|
||
|
||
paramStr = effectparam.GetParamValuebyIndex(4);
|
||
if (WorldUIRoot.Instance != null && paramStr == "1")
|
||
WorldUIRoot.Instance.ShowOrHideHeadRoot(false);
|
||
}
|
||
|
||
if (SceneLogic.CameraController != null)
|
||
{
|
||
var blindEffect = SceneLogic.CameraController.AddCameraEffect<BlindEffect>(BlindCreateEffect);
|
||
paramStr = effectparam.GetParamValuebyIndex(1);
|
||
int.TryParse(paramStr, out paramInt);
|
||
blindEffect.grayScaleAmount = paramInt * 1.0f / 100.0f;
|
||
paramStr = effectparam.GetParamValuebyIndex(2);
|
||
int.TryParse(paramStr, out paramInt);
|
||
blindEffect.grayRadiuRange = paramInt * 1.0f / 100.0f;
|
||
paramStr = effectparam.GetParamValuebyIndex(3);
|
||
int.TryParse(paramStr, out paramInt);
|
||
var disable = paramInt;
|
||
var mainPlayer = ObjManager.Instance.MainPlayer;
|
||
if (mainPlayer != null && disable == 1)
|
||
{
|
||
mainPlayer.RemoveSelectTarget();
|
||
//GameManager.gameManager.ActiveScene.DeactiveSelectCircle();
|
||
mainPlayer.AddDisableState(((int)Games.ImpactModle.DISABLESTATE.Disable_Select).ToFlag());
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
private static void BlindCreateEffect(BlindEffect blindEffect)
|
||
{
|
||
var shader = Shader.Find("Zhanyou/BlindEffect");
|
||
blindEffect.curMaterial = new Material(shader);
|
||
}
|
||
|
||
public void RecoverSee()
|
||
{
|
||
if (objCharacter.ObjType != GameDefine_Globe.OBJ_TYPE.OBJ_MAIN_PLAYER)
|
||
return;
|
||
|
||
if (SceneLogic.CameraController != null)
|
||
{
|
||
SceneLogic.CameraController.ResetLayerMask();
|
||
SceneLogic.CameraController.RemoveCameraEffect<BlindEffect>();
|
||
}
|
||
|
||
var paramid = Data.GetParamValuebyIndex(0);
|
||
var effectparam = TableManager.GetEffectParamByID(paramid, 0);
|
||
|
||
var disable = effectparam.GetParamValuebyIndex(3);
|
||
int paramInt;
|
||
int.TryParse(disable, out paramInt);
|
||
var mainPlayer = ObjManager.Instance.MainPlayer;
|
||
if (mainPlayer != null && paramInt == 1)
|
||
mainPlayer.DelDisableState(((int)Games.ImpactModle.DISABLESTATE.Disable_Select).ToFlag());
|
||
if (WorldUIRoot.Instance != null)
|
||
WorldUIRoot.Instance.ShowOrHideHeadRoot(true);
|
||
}
|
||
} |