Exemple #1
0
    public void Init(PalGameObjectBase goBase)
    {
        this.m_material = base.GetComponent <Renderer>().material;
        this.Gob        = goBase;
        //UIManager.SetAllToUILayer(base.transform);
        if (this.Gob.model == null)
        {
            if (this.Gob.transform.childCount > 0)
            {
                this.targetTF = this.Gob.transform.GetChild(0);
            }
            else
            {
                this.targetTF = this.Gob.transform;
            }
        }
        else
        {
            this.targetTF = this.Gob.model.transform;
        }
        PalGameObjectBase expr_9D = this.Gob;

        expr_9D.DestroyEvent = (Action <PalGameObjectBase>)Delegate.Combine(expr_9D.DestroyEvent, new Action <PalGameObjectBase>(this.ObjdestroyEvent));
        PalGameObjectBase expr_C4 = this.Gob;

        expr_C4.OnCurObjTypeChange = (Action <PalGameObjectBase>)Delegate.Combine(expr_C4.OnCurObjTypeChange, new Action <PalGameObjectBase>(this.OnCurObjTypeChange));
        this.ChangeTex(this.Gob.CurObjType);
    }
Exemple #2
0
 /// <summary>
 /// 判断加载完毕
 /// </summary>
 /// <param name="obj"></param>
 public void JudgeLoadOver(PalGameObjectBase obj)
 {
     //if (!EntityManager.LoadTogether)
     //{
     //	if (this.palObjs.Count < 1)
     //	{
     //		this.LoadOver();
     //		return;
     //	}
     //	this.palObjs.RemoveAt(0);
     //	if (this.palObjs.Count < 1)
     //	{
     //		this.LoadOver();
     //		return;
     //	}
     //	PalGameObjectBase palGameObjectBase = this.palObjs[0];
     //	palGameObjectBase.dobjLayer = this;
     //	palGameObjectBase.LoadModel();
     //}
     //else
     //{
     //	this.palObjs.Remove(obj);
     //	if (this.palObjs.Count < 1)
     //	{
     //		this.LoadOver();
     //		return;
     //	}
     //}
 }
Exemple #3
0
 public void ShowLoadingObjs()
 {
     for (int i = 0; i < this.palObjs.Count; i++)
     {
         PalGameObjectBase palGameObjectBase = this.palObjs[i];
         string            text = "\t\t" + palGameObjectBase.name;
     }
 }
Exemple #4
0
 private void OnCurObjTypeChange(PalGameObjectBase obj)
 {
     if (obj.CurObjType == ObjType.none)
     {
         base.gameObject.SetActive(false);
         return;
     }
     base.gameObject.SetActive(true);
     this.ChangeTex(obj.CurObjType);
 }
Exemple #5
0
        //public static bool Judgment(GameFileStream stream)
        //{
        //	bool flag = false;
        //	int num = stream.ReadInt();
        //	if (num > 0)
        //	{
        //		flag = true;
        //	}
        //	for (int i = 0; i < num; i++)
        //	{
        //		//ConditionalJudgment.enum_JudgmentType type = (ConditionalJudgment.enum_JudgmentType)stream.ReadInt();
        //		//int value = stream.ReadInt();
        //		//int idx = stream.ReadInt();
        //		//int flag2 = FlagManager.GetFlag(idx);
        //		//string text = null;
        //		//if (!new ConditionalJudgment(type, value).Judgment(flag2, out text))
        //		//{
        //		//	flag = false;
        //		//}
        //	}
        //	num = stream.ReadInt();
        //	bool flag3 = true;
        //	for (int j = 0; j < num; j++)
        //	{
        //		//ConditionalJudgment.enum_JudgmentType type2 = (ConditionalJudgment.enum_JudgmentType)stream.ReadInt();
        //		//int value2 = stream.ReadInt();
        //		//int idx2 = stream.ReadInt();
        //		//int flag4 = FlagManager.GetFlag(idx2);
        //		//string text2 = null;
        //		//if (!new ConditionalJudgment(type2, value2).Judgment(flag4, out text2))
        //		//{
        //		//	flag3 = false;
        //		//}
        //	}
        //	return !flag && flag3;
        //}

        //public void WriteCondition(GameFileStream stream)
        //{
        //	stream.WriteInt(this.disableSufficientFlags.Count);
        //	for (int i = 0; i < this.disableSufficientFlags.Count; i++)
        //	{
        //		stream.WriteInt((int)this.disableSufficientConditions[i].type);
        //		stream.WriteInt(this.disableSufficientConditions[i].value);
        //		stream.WriteInt(this.disableSufficientFlags[i]);
        //	}
        //	stream.WriteInt(this.enableNecessaryFlgs.Count);
        //	for (int j = 0; j < this.enableNecessaryFlgs.Count; j++)
        //	{
        //		stream.WriteInt((int)this.enableNecessaryConditions[j].type);
        //		stream.WriteInt(this.enableNecessaryConditions[j].value);
        //		stream.WriteInt(this.enableNecessaryFlgs[j]);
        //	}
        //}

        public void SetActiveAllModels(bool bActive)
        {
            for (int i = 0; i < this.palObjects.Count; i++)
            {
                PalGameObjectBase palGameObjectBase = this.palObjects[i];
                if (!(palGameObjectBase == null))
                {
                    //UtilFun.SetActive(palGameObjectBase.gameObject, bActive);
                }
            }
        }
 private void SetAllMonsterActive(bool bActive)
 {
     for (int i = 0; i < this.Monsters.Count; i++)
     {
         PalGameObjectBase palGameObjectBase = this.Monsters[i];
         if (!(palGameObjectBase == null))
         {
             palGameObjectBase.gameObject.SetActive(bActive);
         }
     }
 }
 public static void AddTrigger(PalGameObjectBase trigger)
 {
     if (CharactersManager.Instance.Triggers.Contains(trigger))
     {
         return;
     }
     //if (trigger.GetComponent<SetActiveByFlag>() != null)
     //{
     //	return;
     //}
     CharactersManager.Instance.Triggers.Add(trigger);
 }
 public static void AddMonster(PalGameObjectBase monster)
 {
     if (CharactersManager.Instance.Monsters.Contains(monster))
     {
         return;
     }
     //if (monster.GetComponent<DontSetActiveByState>() != null)
     //{
     //	return;
     //}
     CharactersManager.Instance.Monsters.Add(monster);
 }
Exemple #9
0
 private void OnDestroy()
 {
     if (this.Gob != null)
     {
         PalGameObjectBase expr_17 = this.Gob;
         expr_17.DestroyEvent = (Action <PalGameObjectBase>)Delegate.Remove(expr_17.DestroyEvent, new Action <PalGameObjectBase>(this.ObjdestroyEvent));
         PalGameObjectBase expr_3E = this.Gob;
         expr_3E.OnCurObjTypeChange = (Action <PalGameObjectBase>)Delegate.Remove(expr_3E.OnCurObjTypeChange, new Action <PalGameObjectBase>(this.OnCurObjTypeChange));
     }
     if (this.m_material != null)
     {
         UnityEngine.Object.Destroy(this.m_material);
     }
 }
    //public static bool ExistCharacter(PalGameObjectBase npc)
    //{
    //	//Dictionary<PalGameObjectBase, MapTarget> characters = CharactersManager.Instance.Characters;
    //	return characters.ContainsKey(npc);
    //}

    public static void AddCharacter(PalGameObjectBase npc)
    {
        Dictionary <PalGameObjectBase, MapTarget> characters = CharactersManager.Instance.Characters;

        if (characters.ContainsKey(npc))
        {
            Debug.LogError("已经在Characters中包含了");
            return;
        }
        MapTarget value = MapTarget.CreateNew(npc);

        characters.Add(npc, value);
        npc.DestroyEvent = (Action <PalGameObjectBase>)Delegate.Combine(npc.DestroyEvent, new Action <PalGameObjectBase>(CharactersManager.Instance.ObjdestroyEvent));
    }
Exemple #11
0
 public static MapTarget CreateNew(PalGameObjectBase Gob)
 {
     //if (Gob == null)
     //{
     //	return null;
     //}
     ////Transform transform = MapWatch.Instance.Points.transform;
     //string name = Gob.name + "_MT";
     ////Transform transform2 = transform.Find(name);
     ////if (transform2 != null)
     ////{
     ////	MapTarget component = transform2.GetComponent<MapTarget>();
     ////	if (component != null && component.Gob == Gob)
     ////	{
     ////		Debug.LogError("Error : 已经存在一个对应 " + Gob.name + " 的MapTarget 删除掉");
     ////		UnityEngine.Object.Destroy(transform2.gameObject);
     ////	}
     ////}
     //GameObject gameObject = FileLoader.LoadObjectFromFile<GameObject>("UI/MapTarget".ToAssetBundlePath(), true, true);
     //GameObject gameObject2;
     //if (gameObject == null)
     //{
     //	Debug.LogError("Error : MapTarget UI/MapTarget 没有找到");
     //	gameObject2 = new GameObject(name);
     //}
     //else
     //{
     //	gameObject2 = gameObject;
     //}
     //gameObject2.name = name;
     ////if (MapWatch.Instance != null)
     ////{
     ////	gameObject2.transform.parent = MapWatch.Instance.Points.transform;
     ////}
     ////else
     ////{
     ////	Debug.LogError("没有找到MapWatch.Instance");
     ////}
     //gameObject2.transform.localScale = new Vector3(100f, 100f, 1f);
     //MapTarget mapTarget = gameObject2.GetComponent<MapTarget>();
     //if (mapTarget == null)
     //{
     //	mapTarget = gameObject2.AddComponent<MapTarget>();
     //}
     //mapTarget.Init(Gob);
     //return mapTarget;
     return(null);
 }
 private void SetAllTriggerActive(bool bActive)
 {
     for (int i = 0; i < this.Triggers.Count; i++)
     {
         PalGameObjectBase palGameObjectBase = this.Triggers[i];
         if (!(palGameObjectBase == null))
         {
             Collider[] componentsInChildren = palGameObjectBase.GetComponentsInChildren <Collider>(true);
             for (int j = 0; j < componentsInChildren.Length; j++)
             {
                 Collider collider = componentsInChildren[j];
                 collider.enabled = bActive;
             }
         }
     }
 }
Exemple #13
0
        public void Clear()
        {
            Transform transform = base.transform;

            for (int i = 0; i < transform.childCount; i++)
            {
                Transform child = transform.GetChild(i);
                if (!(child == null))
                {
                    PalGameObjectBase component = child.GetComponent <PalGameObjectBase>();
                    if (!(component == null))
                    {
                        component.Clear();
                    }
                }
            }
        }
Exemple #14
0
 private void ObjdestroyEvent(PalGameObjectBase obj)
 {
     UnityEngine.Object.Destroy(base.gameObject);
 }
 private void ObjdestroyEvent(PalGameObjectBase obj)
 {
     //	this.Characters.Remove(obj);
 }
 public static void AddObj(PalGameObjectBase obj)
 {
     CharactersManager.Instance.Objs.Add(obj);
 }