using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
using UnityEngine.EventSystems;
///
/// 龙骨英雄动画管理
///
public class DragonBonesBGControler : MonoBehaviour
{
///
/// 单键
///
private static DragonBonesBGControler pInit = null;
///
/// 人物节点
///
private GameObject mHeroModelRoot = null;
///
/// 人物 控制节点
///
public InputTouchContorler mInputTouchContorler = null;
///
/// 相机映射图片
///
private RenderTexture renderTexture;
///
///
///
private Camera mHeroModelCamera;
///
/// 相机动态render图片(人物角色)
///
public RenderTexture CameraRenderTexture
{
get { return renderTexture; }
}
/////
///// 人物节点
/////
//private GameObject mShopWindow_HeroModelRoot = null;
/////
///// 商店界面的 相机映射图片
/////
//private RenderTexture shopWindow_renderTexture;
/////
///// 商店界面的 动态人物角色
/////
//public RenderTexture mShopWindow_HeroRenderTexture
//{
// get { return shopWindow_renderTexture; }
//}
//---------------------抽奖 start---------------------------
private GameObject mLuckDrawRoot = null;
///
/// 抽奖人物节点
///
private GameObject mLuckDrawWindow_HeroModelRoot = null;
///
/// 抽奖界面的 相机映射图片
///
private RenderTexture LuckDrawWindow_renderTexture;
///
/// 抽奖界面的 动态人物角色
///
public RenderTexture mLuckDrawWindow_HeroRenderTexture
{
get { return LuckDrawWindow_renderTexture; }
}
//---------------------抽奖 end---------------------------
//---------------------对话 start---------------------------
private GameObject mDialogRoot = null;
///
/// 对话人物节点
///
private GameObject mDialogWindow_HeroModelRoot = null;
///
/// 对话界面的 相机映射图片
///
private RenderTexture DialogWindow_renderTexture;
///
/// 对话界面的 动态人物角色
///
public RenderTexture mDialogWindow_HeroRenderTexture
{
get { return DialogWindow_renderTexture; }
}
//---------------------对话 end---------------------------
//---------------------引导 start---------------------------
private GameObject mGuideRoot = null;
///
/// 引导人物节点
///
private GameObject mGuideWindow_HeroModelRoot = null;
///
/// 引导界面的 相机映射图片
///
private RenderTexture GuideWindow_renderTexture;
///
/// 引导界面的 动态人物角色
///
public RenderTexture mGuideWindow_HeroRenderTexture
{
get { return GuideWindow_renderTexture; }
}
//---------------------引导 end---------------------------
///
/// 游戏内 展示的英雄模型列表
///
public Dictionary existMainDisplayHeroModelDic = new Dictionary();
///
/// 获取管理者
///
/// 单键实例
public static DragonBonesBGControler Instance()
{
if (pInit == null)
{
GameObject obj = GameObject.Find("ForeverUI/DragonBonesBG");
pInit = obj.AddComponent();
}
return pInit;
}
///
/// start
///
private void Awake()
{
//renderTexure赋值
mHeroModelCamera = this.transform.Find("Camera").GetComponent();
if (mHeroModelCamera.GetComponent() != null)
{
Destroy(mHeroModelCamera.GetComponent());
}
renderTexture = new RenderTexture(1080, 1920, 24, RenderTextureFormat.ARGB32);
mHeroModelRoot = this.transform.Find("Model").gameObject;
mHeroModelCamera.targetTexture = renderTexture;
mInputTouchContorler = mHeroModelRoot.GetComponent();
if (mInputTouchContorler == null)
{
AssemblyHelper.Instance.BindScript("InputTouchContorler", mHeroModelRoot);
mInputTouchContorler = mHeroModelRoot.GetComponent();
}
//shopWindow_renderTexture = new RenderTexture(1080, 1920, 24, RenderTextureFormat.ARGB32);
//Camera shopWindowCamera = this.transform.Find("ShopDragonBones/Camera").GetComponent();
//shopWindowCamera.targetTexture = shopWindow_renderTexture;
//mShopWindow_HeroModelRoot = this.transform.Find("ShopDragonBones/Model").gameObject;
mLuckDrawRoot = this.transform.Find("LuckDrawDragonBones").gameObject;
LuckDrawWindow_renderTexture = new RenderTexture(1080, 1920, 24, RenderTextureFormat.ARGB32);
Camera LuckDrawWindowCamera = this.transform.Find("LuckDrawDragonBones/Camera").GetComponent();
LuckDrawWindowCamera.targetTexture = LuckDrawWindow_renderTexture;
mLuckDrawWindow_HeroModelRoot = this.transform.Find("LuckDrawDragonBones/Model").gameObject;
mLuckDrawRoot.SetActive(false);
mDialogRoot = this.transform.Find("DialogDragonBones").gameObject;
DialogWindow_renderTexture = new RenderTexture(1080, 1920, 24, RenderTextureFormat.ARGB32);
Camera DialogWindowCamera = this.transform.Find("DialogDragonBones/Camera").GetComponent();
DialogWindowCamera.targetTexture = DialogWindow_renderTexture;
mDialogWindow_HeroModelRoot = this.transform.Find("DialogDragonBones/Model").gameObject;
mDialogRoot.SetActive(false);
mGuideRoot = this.transform.Find("GuideDragonBones").gameObject;
GuideWindow_renderTexture = new RenderTexture(1080, 1920, 24, RenderTextureFormat.ARGB32);
Camera GuideWindowCamera = this.transform.Find("GuideDragonBones/Camera").GetComponent();
GuideWindowCamera.targetTexture = GuideWindow_renderTexture;
mGuideWindow_HeroModelRoot = this.transform.Find("GuideDragonBones/Model").gameObject;
mGuideRoot.SetActive(false);
}
///
///
///
public void Clear()
{
Transform[] allChild = mHeroModelRoot.GetComponentsInChildren(true);
foreach (Transform ele in allChild)
{
if (ele != mHeroModelRoot.transform)
{
Destroy(ele.gameObject);
}
}
existMainDisplayHeroModelDic.Clear();
}
public string CurrentShowHeroModel { get; set; }
///
/// 显示某哦英雄
///
/// 模型ID
/// 回调
public void ShowHeroModel(string heromodel, Vector2 posOffset, Action callBack = null)
{
if (existMainDisplayHeroModelDic.ContainsKey(heromodel))
{
GameObject ani = existMainDisplayHeroModelDic[heromodel];
DragonBones.UnityArmatureComponent armatureComponent = ani.GetComponent();
if (armatureComponent != null)
{
if (armatureComponent.name != CurrentShowHeroModel)
{
armatureComponent.gameObject.SetActive(false);
armatureComponent.enabled = false;
}
else
{
if (callBack != null)
{
callBack(armatureComponent);
}
}
}
}
else
{
# region 加载方式二:独立factory
//DragonBonesManager.Instance.QueryAsset(heromodel, (model, textureAtlas) =>
// {
// DragonBones.UnityFactory temp = new DragonBones.UnityFactory();
// temp.ParseDragonBonesData((Dictionary)MiniJSON.Json.Deserialize(model.mSkeletonJson.text), heromodel, 0.01f);
// temp.ParseTextureAtlasData((Dictionary)MiniJSON.Json.Deserialize(model.mTextureJson.text), textureAtlas, heromodel);
// //temp.LoadDragonBonesData(model.mSkeletonJson, heromodel);
// //temp.LoadTextureAtlasData(model.mTextureJson, textureAtlas, heromodel);
// var armatureComponent = temp.BuildArmatureComponent(heromodel, heromodel);
// ////以后这个y去读取数据库的表~~
// ////LogHelper.LogError("MainShowPositionOffset::" + y);
// ////armatureComponent.armature.GetBone(heromodel).offset.y = y*-1;
// ////armatureComponent.armature.InvalidUpdate(heromodel);
// ////armatureComponent.gameObject.name = heromodel;
// armatureComponent.transform.SetParent(mModel.transform);
// armatureComponent.transform.localPosition = Vector3.zero + new Vector3(posOffset.x, posOffset.y, 0);
// armatureComponent.transform.localScale = new Vector3(1, 1, 1);
// UnityEngine.Transform[] all = armatureComponent.GetComponentsInChildren(true);
// foreach (UnityEngine.Transform rc in all)
// {
// rc.gameObject.layer = LayerMask.NameToLayer("DragonBonesLayer"); //指定Layer
// }
// if (!existModelDic.ContainsKey(heromodel))
// {
// existModelDic.Add(heromodel, armatureComponent.gameObject);
// }
// else
// {
// existModelDic[heromodel] = armatureComponent.gameObject;
// }
// if (callBack != null)
// {
// callBack(armatureComponent);
// }
// });
#endregion
#region 加载方式一: 统一factory 会出现一个问题~~
DragonBonesManager.Instance.QueryAsset(heromodel, (model, textureAtlas) =>
{
DragonBones.UnityFactory.factory.ParseDragonBonesData((Dictionary)MiniJSON.Json.Deserialize(model.mSkeletonJson.text), heromodel, 0.01f);
DragonBones.UnityFactory.factory.ParseTextureAtlasData((Dictionary)MiniJSON.Json.Deserialize(model.mTextureJson.text), textureAtlas, heromodel);
var armatureComponent = CreateDragonModel(heromodel, "DragonBonesLayer");
SetDragonModelNode(armatureComponent, mHeroModelRoot.transform, posOffset);
if (!existMainDisplayHeroModelDic.ContainsKey(heromodel))
{
existMainDisplayHeroModelDic.Add(heromodel, armatureComponent.gameObject);
}
else
{
existMainDisplayHeroModelDic[heromodel] = armatureComponent.gameObject;
}
if (armatureComponent.name != CurrentShowHeroModel)
{
armatureComponent.gameObject.SetActive(false);
armatureComponent.enabled = false;
}
else
{
if (callBack != null)
{
callBack(armatureComponent);
}
}
});
#endregion
}
}
///
/// 设置人物模型展示的时候的偏移
///
///
///
private void SetDragonModelNode(DragonBones.UnityArmatureComponent arm, Transform parentRoot, Vector2 posOffset)
{
arm.transform.SetParent(parentRoot);
//// Change armatureposition.
arm.transform.localPosition = Vector3.zero + new Vector3(posOffset.x, posOffset.y, 0);
arm.transform.localScale = new Vector3(2, 2, 2); // Vector3.one;
}
///
/// 创建一个真实的龙骨动画在scene中
///
///
///
public DragonBones.UnityArmatureComponent CreateDragonModel(string heromodel, string layerName)
{
if (DragonBones.UnityFactory.factory.GetDragonBonesData(heromodel) == null)
{
return null;
}
if (DragonBones.UnityFactory.factory.GetTextureAtlasData(heromodel) == null)
{
return null;
}
var armatureComponent = DragonBones.UnityFactory.factory.BuildArmatureComponent(heromodel, heromodel);
armatureComponent.gameObject.SetActive(false);
armatureComponent.enabled = false;
armatureComponent.gameObject.name = heromodel;
armatureComponent.transform.localScale = new Vector3(2, 2, 2);
UnityEngine.Transform[] all = armatureComponent.GetComponentsInChildren(true);
foreach (UnityEngine.Transform rc in all)
{
rc.gameObject.layer = LayerMask.NameToLayer(layerName); //指定Layer
}
//////////////////记录 记录 记录//////////////////////////
if (DragonBonesManager.Instance.loadDBDataRecord.ContainsKey(heromodel))
{
UseDragonBoneRecordVo id2 = DragonBonesManager.Instance.loadDBDataRecord[heromodel];
id2.createGameObjectList.Add(armatureComponent.gameObject);
id2.lastUseDbDataTs = DateTime.Now.ToUnixTimeStamp();
id2.useDbDataCount += 1;
}
return armatureComponent;
}
///
///【 检查函数】 判断某个模型的龙骨数据是否已经加载进去了。
///
///
///
public bool CheckFactoryIsExistSomeModelData(string model)
{
if (DragonBones.UnityFactory.factory.GetDragonBonesData(model) == null)
{
return false;
}
if (DragonBones.UnityFactory.factory.GetTextureAtlasData(model) == null)
{
return false;
}
return true;
}
///
///
///
///
public void AddDragonBoneDataUse(string model)
{
if (DragonBonesManager.Instance.loadDBDataRecord.ContainsKey(model))
{
UseDragonBoneRecordVo id2 = DragonBonesManager.Instance.loadDBDataRecord[model];
id2.lastUseDbDataTs = DateTime.Now.ToUnixTimeStamp();
}
}
///
/// 关闭某个英雄的模型
///
/// 模型ID
public void SetHeroModelEnabled(string heromodel)
{
if (existMainDisplayHeroModelDic.ContainsKey(heromodel))
{
GameObject ani = existMainDisplayHeroModelDic[heromodel];
if (ani == null)
return;
DragonBones.UnityArmatureComponent armatureComponent = ani.GetComponent();
if (armatureComponent != null)
{
armatureComponent.RemoveAllEventListener();
}
armatureComponent.enabled = false;
ani.SetActive(false);
}
}
///
/// 关闭所有 展示的英雄的模型
///
public void SetAllDisplayHeroEnabled()
{
foreach (string heromodel in existMainDisplayHeroModelDic.Keys)
{
SetHeroModelEnabled(heromodel);
}
ResetCamera();
}
///
/// 根据英雄的龙骨数据,查找scne场景中已经创建对应的对象
///
///
///
public DragonBones.UnityArmatureComponent QuerySomeHeroArmature(string heromodel)
{
if (existMainDisplayHeroModelDic.ContainsKey(heromodel))
{
GameObject ani = existMainDisplayHeroModelDic[heromodel];
DragonBones.UnityArmatureComponent armatureComponent = ani.GetComponent();
if (armatureComponent != null)
{
return armatureComponent;
}
return null;
}
return null;
}
///
/// 查找当前激活的展示龙骨模型
///
///
public string GetActiveHeroModel()
{
string result = string.Empty;
foreach (string heromodel in existMainDisplayHeroModelDic.Keys)
{
GameObject ani = existMainDisplayHeroModelDic[heromodel];
if (ani.activeSelf)
{
result += heromodel + ";";
}
}
return result;
}
///
/// 默认相机的正交大小
///
private const float CurCameraSize = 13.0f;
///
/// 模型缩放
///
internal void OnChangeCameraSize(float cameraSize)
{
mHeroModelCamera.GetComponent().orthographicSize = cameraSize;
}
///
/// 模型被拖动
///
internal void OnChangeModelPosition(Vector2 delta)
{
Vector2 temp = new Vector2(12 * (delta.x / 1080), 16 * (delta.y / 1920));
float x = 0, y = 0;
RectTransform tempRect = mHeroModelRoot.GetComponent();
Vector2 tempPos = tempRect.anchoredPosition + temp;
x = tempPos.x;
y = tempPos.y;
if (tempPos.x > 12)
{
x = 12;
}
if (tempPos.x < -12)
{
x = -12;
}
if (tempPos.y > 16)
{
y = 12;
}
if (tempPos.y < -16)
{
y = -12;
}
Vector2 destPos = new Vector2(x, y);
////LogHelper.LogError("affffffffff::"+ destPos.ToString());
tempRect.anchoredPosition = destPos;
}
///
/// 充值龙骨相机的大小 以及模型的展示位置
///
internal void ResetCamera()
{
mHeroModelCamera.orthographicSize = CurCameraSize;
mHeroModelRoot.GetComponent().anchoredPosition = Vector2.zero;
}
/////
///// 打开指定角色在商店的动画
/////
//internal void ShowShopDragonBones(string heromodel, Vector2 posOffset, Action callBack = null)
//{
// bool checkHasLoad = false;
// if (mShopWindow_HeroModelRoot.transform.childCount > 0)
// {
// Transform s = mShopWindow_HeroModelRoot.transform.Find(heromodel);
// if (s != null)
// {
// checkHasLoad = true;
// if (callBack != null)
// {
// callBack(s.GetComponent());
// }
// return;
// }
// }
// if (!checkHasLoad)
// {
// var armatureComponent = CreateDragonModel(heromodel, "ShopDragon");
// if (armatureComponent == null)
// {
// DragonBonesManager.Instance.QueryAsset(heromodel, (model, textureAtlas) =>
// {
// DragonBones.UnityFactory.factory.ParseDragonBonesData((Dictionary)MiniJSON.Json.Deserialize(model.mSkeletonJson.text), heromodel, 0.01f);
// DragonBones.UnityFactory.factory.ParseTextureAtlasData((Dictionary)MiniJSON.Json.Deserialize(model.mTextureJson.text), textureAtlas, heromodel);
// armatureComponent = CreateDragonModel(heromodel, "ShopDragon");
// SetDragonModelNode(armatureComponent, mShopWindow_HeroModelRoot.transform, posOffset);
// if (callBack != null)
// {
// callBack(armatureComponent);
// }
// });
// }
// else
// {
// SetDragonModelNode(armatureComponent, mShopWindow_HeroModelRoot.transform, posOffset);
// if (callBack != null)
// {
// callBack(armatureComponent);
// }
// }
// }
//}
/////
///// 关闭所有商店动画
/////
//internal void CloseAllShopDragonBones()
//{
// if (mShopWindow_HeroModelRoot.transform.childCount > 0)
// {
// for (int i = 0; i < mShopWindow_HeroModelRoot.transform.childCount; i++)
// {
// GameObject ani = mShopWindow_HeroModelRoot.transform.GetChild(i).gameObject;
// DragonBones.UnityArmatureComponent armatureComponent = ani.GetComponent();
// if (armatureComponent != null)
// {
// armatureComponent.RemoveAllEventListener();
// }
// armatureComponent.enabled = false;
// ani.SetActive(false);
// }
// }
//}
///
/// 打开指定角色在抽奖的动画
///
internal void ShowLuckDrawDragonBones(string heromodel, Vector2 posOffset, Action callBack = null)
{
if (this.mLuckDrawRoot.activeSelf == false)
{
this.mLuckDrawRoot.SetActive(true);
}
bool checkHasLoad = false;
if (mLuckDrawWindow_HeroModelRoot.transform.childCount > 0)
{
Transform s = mLuckDrawWindow_HeroModelRoot.transform.Find(heromodel);
if (s != null)
{
checkHasLoad = true;
if (callBack != null)
{
callBack(s.GetComponent());
}
return;
}
}
if (!checkHasLoad)
{
var armatureComponent = CreateDragonModel(heromodel, "LuckDragon");
if (armatureComponent == null)
{
DragonBonesManager.Instance.QueryAsset(heromodel, (model, textureAtlas) =>
{
DragonBones.UnityFactory.factory.ParseDragonBonesData((Dictionary)MiniJSON.Json.Deserialize(model.mSkeletonJson.text), heromodel, 0.01f);
DragonBones.UnityFactory.factory.ParseTextureAtlasData((Dictionary)MiniJSON.Json.Deserialize(model.mTextureJson.text), textureAtlas, heromodel);
armatureComponent = CreateDragonModel(heromodel, "LuckDragon");
SetDragonModelNode(armatureComponent, mLuckDrawWindow_HeroModelRoot.transform, posOffset);
if (callBack != null)
{
callBack(armatureComponent);
}
});
}
else
{
SetDragonModelNode(armatureComponent, mLuckDrawWindow_HeroModelRoot.transform, posOffset);
if (callBack != null)
{
callBack(armatureComponent);
}
}
}
}
///
/// 关闭所有抽奖动画
///
internal void CloseAllLuckDrawDragonBones()
{
if (mLuckDrawWindow_HeroModelRoot.transform.childCount > 0)
{
for (int i = 0; i < mLuckDrawWindow_HeroModelRoot.transform.childCount; i++)
{
GameObject ani = mLuckDrawWindow_HeroModelRoot.transform.GetChild(i).gameObject;
DragonBones.UnityArmatureComponent armatureComponent = ani.GetComponent();
if (armatureComponent != null)
{
armatureComponent.RemoveAllEventListener();
}
armatureComponent.enabled = false;
ani.SetActive(false);
}
}
}
///
///
///
internal void CloseLuckDrawCameraDraw()
{
this.mLuckDrawRoot.SetActive(false);
}
///
/// 打开指定角色在对话里的动画
///
internal void ShowDialogDragonBones(string heromodel, Vector2 posOffset, Action callBack = null)
{
if (this.mDialogRoot.activeSelf == false)
{
this.mDialogRoot.SetActive(true);
}
bool checkHasLoad = false;
if (mDialogWindow_HeroModelRoot.transform.childCount > 0)
{
Transform s = mDialogWindow_HeroModelRoot.transform.Find(heromodel);
if (s != null)
{
checkHasLoad = true;
if (callBack != null)
{
callBack(s.GetComponent());
}
return;
}
}
if (!checkHasLoad)
{
var armatureComponent = CreateDragonModel(heromodel, "DialogDragon");
if (armatureComponent == null)
{
DragonBonesManager.Instance.QueryAsset(heromodel, (model, textureAtlas) =>
{
DragonBones.UnityFactory.factory.ParseDragonBonesData((Dictionary)MiniJSON.Json.Deserialize(model.mSkeletonJson.text), heromodel, 0.01f);
DragonBones.UnityFactory.factory.ParseTextureAtlasData((Dictionary)MiniJSON.Json.Deserialize(model.mTextureJson.text), textureAtlas, heromodel);
armatureComponent = CreateDragonModel(heromodel, "DialogDragon");
SetDragonModelNode(armatureComponent, mDialogWindow_HeroModelRoot.transform, posOffset);
if (callBack != null)
{
callBack(armatureComponent);
}
});
}
else
{
SetDragonModelNode(armatureComponent, mDialogWindow_HeroModelRoot.transform, posOffset);
if (callBack != null)
{
callBack(armatureComponent);
}
}
}
}
///
/// 关闭所有对话动画
///
internal void CloseAllDialogDragonBones()
{
if (mDialogWindow_HeroModelRoot.transform.childCount > 0)
{
for (int i = 0; i < mDialogWindow_HeroModelRoot.transform.childCount; i++)
{
GameObject ani = mDialogWindow_HeroModelRoot.transform.GetChild(i).gameObject;
DragonBones.UnityArmatureComponent armatureComponent = ani.GetComponent();
if (armatureComponent != null)
{
armatureComponent.RemoveAllEventListener();
}
armatureComponent.enabled = false;
ani.SetActive(false);
}
}
}
///
///
///
internal void CloseDialogCameraDraw()
{
this.mDialogRoot.SetActive(false);
}
///
/// 打开指定角色在对话里的动画
///
internal void ShowGuideDragonBones(string heromodel, Vector2 posOffset, Action callBack = null)
{
if (!this.mGuideRoot.activeSelf)
{
this.mGuideRoot.SetActive(true);
}
bool checkHasLoad = false;
if (mGuideWindow_HeroModelRoot.transform.childCount > 0)
{
Transform s = mGuideWindow_HeroModelRoot.transform.Find(heromodel);
if (s != null)
{
checkHasLoad = true;
if (callBack != null)
{
callBack(s.GetComponent());
}
return;
}
}
if (!checkHasLoad)
{
var armatureComponent = CreateDragonModel(heromodel, "GuideDragon");
if (armatureComponent == null)
{
DragonBonesManager.Instance.QueryAsset(heromodel, (model, textureAtlas) =>
{
DragonBones.UnityFactory.factory.ParseDragonBonesData((Dictionary)MiniJSON.Json.Deserialize(model.mSkeletonJson.text), heromodel, 0.01f);
DragonBones.UnityFactory.factory.ParseTextureAtlasData((Dictionary)MiniJSON.Json.Deserialize(model.mTextureJson.text), textureAtlas, heromodel);
armatureComponent = CreateDragonModel(heromodel, "GuideDragon");
if (armatureComponent == null)
{
LogHelper.LogError("出错啦。。。。。。。。。。。。。。" + heromodel);
}
SetDragonModelNode(armatureComponent, mGuideWindow_HeroModelRoot.transform, posOffset);
if (callBack != null)
{
callBack(armatureComponent);
}
});
}
else
{
SetDragonModelNode(armatureComponent, mGuideWindow_HeroModelRoot.transform, posOffset);
if (callBack != null)
{
callBack(armatureComponent);
}
}
}
}
///
/// 打开指定角色在战斗中的动画
///
internal void ShowBattleDragonBones(string heromodel, Transform targetTran, Vector2 posOffset, Action callBack = null)
{
var armatureComponent = CreateDragonModel(heromodel, "DragonBonesLayer");
if (armatureComponent == null)
{
DragonBonesManager.Instance.QueryAsset(heromodel, (model, textureAtlas) =>
{
DragonBones.UnityFactory.factory.ParseDragonBonesData((Dictionary)MiniJSON.Json.Deserialize(model.mSkeletonJson.text), heromodel, 0.01f);
DragonBones.UnityFactory.factory.ParseTextureAtlasData((Dictionary)MiniJSON.Json.Deserialize(model.mTextureJson.text), textureAtlas, heromodel);
armatureComponent = CreateDragonModel(heromodel, "GuideDragon");
if (armatureComponent == null)
{
LogHelper.LogError("出错啦。。。。。。。。。。。。。。" + heromodel);
}
SetDragonModelNode(armatureComponent, targetTran, posOffset);
if (callBack != null)
{
callBack(armatureComponent);
}
});
}
else
{
SetDragonModelNode(armatureComponent, targetTran, posOffset);
if (callBack != null)
{
callBack(armatureComponent);
}
}
}
internal void CloseGuideDragonBonesByName(string dname)
{
if (mGuideWindow_HeroModelRoot.transform.childCount > 0)
{
for (int i = 0; i < mGuideWindow_HeroModelRoot.transform.childCount; i++)
{
GameObject ani = mGuideWindow_HeroModelRoot.transform.GetChild(i).gameObject;
if (ani.gameObject.name == dname)
{
DragonBones.UnityArmatureComponent armatureComponent = ani.GetComponent();
if (armatureComponent != null)
{
armatureComponent.RemoveAllEventListener();
}
armatureComponent.enabled = false;
ani.SetActive(false);
break;
}
}
}
}
///
/// 关闭所有对话动画
///
internal void CloseAllGuideDragonBones()
{
if (mGuideWindow_HeroModelRoot.transform.childCount > 0)
{
for (int i = 0; i < mGuideWindow_HeroModelRoot.transform.childCount; i++)
{
GameObject ani = mGuideWindow_HeroModelRoot.transform.GetChild(i).gameObject;
DragonBones.UnityArmatureComponent armatureComponent = ani.GetComponent();
if (armatureComponent != null)
{
armatureComponent.RemoveAllEventListener();
}
armatureComponent.enabled = false;
ani.SetActive(false);
}
}
}
///
///
///
internal void CloseGuideCameraDraw()
{
this.mGuideRoot.SetActive(false);
}
///
///
///
internal void OpenGuideCameraDraw()
{
this.mGuideRoot.SetActive(true);
}
#region
///
///
///
public List mRecordWindowControleList = new List();
///////////
///////////
///////////
///////////
////////public void AddTouchControl(string window, bool isControl)
////////{
//////// foreach (ControlerWindowdData data in mRecordWindowControleList)
//////// {
//////// if (data.windowName == window)
//////// {
//////// data.controle = isControl;
//////// return;
//////// }
//////// }
//////// ControlerWindowdData temp = new ControlerWindowdData();
//////// temp.windowName = window;
//////// temp.controle = isControl;
//////// mRecordWindowControleList.Add(temp);
//////// ResetChangeControlerState();
////////}
///////////
///////////
///////////
///////////
///////////
////////public void RemoveTouchControl(string window)
////////{
//////// for (int i = mRecordWindowControleList.Count - 1; i >= 0; i--)
//////// {
//////// ControlerWindowdData data = mRecordWindowControleList[i];
//////// if (data.windowName == window)
//////// {
//////// mRecordWindowControleList.RemoveAt(i);
//////// }
//////// }
//////// ResetChangeControlerState();
////////}
///
/// 重置 触控操作展示英雄操作
///
public void ResetChangeControlerState()
{
IsOpenTouchOperateHero = false;
ResetCamera();
if (mInputTouchContorler != null)
{
mInputTouchContorler.Reset();
}
else
{
LogHelper.LogError(" Warnning !!!!!!!!!!!!!mInputTouchContorler == null ");
}
if (mRecordWindowControleList.Count > 0)
{
ControlerWindowdData data = mRecordWindowControleList[mRecordWindowControleList.Count - 1];
IsOpenTouchOperateHero = data.controle;
}
else
{
IsOpenTouchOperateHero = false;
}
}
///
/// 是否开启 触控操作展示英雄操作
///
public static bool IsOpenTouchOperateHero = false;
///
///
///
///
public bool CheckIsOpenTouchOperatehero()
{
//////WJ屏蔽
//return UI_DBControlWindow.Instance().GetCurrentIsSupprotDragDB();
////return IsReadyOpenTouch;
//if (IsOpenTouchOperateHero && IsReadyOpenTouch)
//{
// return true;
//}
////////if (!IsOpenTouchOperateHero)
////////{
//////// return false;
////////}
////////else
////////{
////////PointerEventData data = ExtendedStandaloneInputModule.GetPointerEventData(0) ;
////////RaycastResult s = data.pointerPressRaycast ;
////////RaycastResult c = data.pointerCurrentRaycast;
//////// if(s.gameObject!=null)
//////// Debug.LogError("AAAA::::" + s.gameObject.name);
//////// if (c.gameObject != null)
//////// Debug.LogError("BBBB::::" + c.gameObject.name);
//////// GameObject go = EventSystem.current.currentSelectedGameObject;
//////if (go != null)
//////{
////// Canvas canvas = go.GetComponentInParent