コード例 #1
0
    public string GetComment(EventTrigger._EVENTTRIGGER SelectTrigger, int SelectIndex, out GameObject Item)
    {
        List <GameObject> list = this.GetList(SelectTrigger);

        if (list == null)
        {
            Item = null;
            return("none");
        }
        GameObject gameObject = list[SelectIndex];

        if (gameObject != null)
        {
            EventTriggerItem component = gameObject.GetComponent <EventTriggerItem>();
            if (component != null)
            {
                Item = gameObject;
                string text = component.GetComment();
                if (text == string.Empty)
                {
                    text = component.GetType().ToString();
                }
                return(text);
            }
        }
        Item = null;
        return("none");
    }
コード例 #2
0
    public GameObject GetItem(EventTrigger._EVENTTRIGGER Category, string name)
    {
        List <GameObject> list = this.GetList(Category);

        if (list == null)
        {
            return(null);
        }
        foreach (GameObject current in list)
        {
            if (name.Equals(current.name))
            {
                return(current);
            }
        }
        Transform transform = base.gameObject.transform.FindChild(Category.ToString());

        if (transform != null)
        {
            Transform transform2 = transform.FindChild(name);
            if (transform2 != null)
            {
                return(transform2.gameObject);
            }
        }
        return(null);
    }
コード例 #3
0
 public void ReadXML(XmlReader Reader)
 {
     try
     {
         string attribute = Reader.GetAttribute("Mode");
         this.m_Mode = (EventTrigger._MODE)((int)Enum.Parse(typeof(EventTrigger._MODE), attribute));
         Reader.Read();
         Array values = Enum.GetValues(typeof(EventTrigger._EVENTTRIGGER));
         for (int i = 0; i < values.Length; i++)
         {
             string text = values.GetValue(i).ToString();
             EventTrigger._EVENTTRIGGER category = (EventTrigger._EVENTTRIGGER)((int)Enum.Parse(typeof(EventTrigger._EVENTTRIGGER), text));
             if (Reader.ReadToNextSibling(text))
             {
                 int num = int.Parse(Reader.GetAttribute(0));
                 if (num > 0)
                 {
                     this.ReadListXML(Reader, category);
                     Reader.ReadEndElement();
                 }
             }
         }
         Reader.Read();
     }
     catch (Exception ex)
     {
         TsLog.Log(ex.Message, new object[0]);
     }
 }
コード例 #4
0
 private void ReadListXML(XmlReader Reader, EventTrigger._EVENTTRIGGER Category)
 {
     try
     {
         Reader.Read();
         while (Reader.ReadToNextSibling("Item"))
         {
             if (Reader.NodeType == XmlNodeType.EndElement)
             {
                 break;
             }
             if (Reader.NodeType == XmlNodeType.Element)
             {
                 Reader.MoveToNextAttribute();
                 GameObject item = EventTriggerHelper.CreateEventTriggerItem(this, Category, Reader.Value.ToString());
                 this.AddItem(Category, item);
                 this.ReadItemXML(Reader, ref item);
                 Reader.ReadEndElement();
             }
         }
     }
     catch (Exception ex)
     {
         TsLog.Log(ex.Message, new object[0]);
     }
 }
コード例 #5
0
    public void CleanList(EventTrigger._EVENTTRIGGER eCategory)
    {
        List <GameObject> list = this.GetList(eCategory);

        list.RemoveAll(new Predicate <GameObject>(EventTrigger.CleanListFunc));
        for (int i = 0; i < list.Count; i++)
        {
            this.RenameItemName(eCategory, list[i]);
        }
        Transform transform = base.gameObject.transform.Find("Behavior");

        if (transform != null)
        {
            foreach (Transform transform2 in transform)
            {
                if (!(transform2 == null))
                {
                    if (list.IndexOf(transform2.gameObject) < 0)
                    {
                        UnityEngine.Object.DestroyImmediate(transform2.gameObject);
                    }
                }
            }
        }
    }
コード例 #6
0
    public static GameObject CreateEventTriggerItem(EventTrigger EventTrigger, EventTrigger._EVENTTRIGGER eCategory, string ItemName)
    {
        Transform transform = EventTrigger.gameObject.transform.FindChild(eCategory.ToString());

        if (transform == null)
        {
            transform = new GameObject(eCategory.ToString())
            {
                transform =
                {
                    parent = EventTrigger.gameObject.transform
                }
            }.transform;
        }
        GameObject gameObject = new GameObject(ItemName);

        gameObject.SetActive(true);
        gameObject.transform.parent        = transform.transform;
        gameObject.transform.localPosition = new Vector3(0f, 0f, 0f);
        gameObject.AddComponent(eCategory.ToString());
        if (ItemName != null)
        {
            gameObject.AddComponent(ItemName);
        }
        return(gameObject);
    }
コード例 #7
0
    public static bool DisableEventTriggerItem(EventTrigger Trigger, EventTrigger._EVENTTRIGGER Category, EventTriggerItem PointItem, Type DisableItem)
    {
        List <GameObject> list = Trigger.GetList(Category);

        if (list == null)
        {
            return(false);
        }
        if (PointItem == null)
        {
            return(false);
        }
        int num = list.IndexOf(PointItem.gameObject);

        for (int i = num; i >= 0; i--)
        {
            GameObject gameObject = list[i];
            if (!(gameObject == null))
            {
                Component component = gameObject.GetComponent(DisableItem);
                if (!(component == null))
                {
                    component.gameObject.SetActive(false);
                    return(true);
                }
            }
        }
        return(false);
    }
コード例 #8
0
    public void ActiveItem(EventTrigger._EVENTTRIGGER Category, bool Active)
    {
        List <GameObject> list = this.GetList(Category);

        foreach (GameObject current in list)
        {
            current.SetActive(Active);
        }
    }
コード例 #9
0
    public int AddItem(EventTrigger._EVENTTRIGGER eCategory, GameObject Item)
    {
        List <GameObject> list = this.GetList(eCategory);

        if (list == null)
        {
            return(0);
        }
        return(this.InsertItem(list.Count, eCategory, Item));
    }
コード例 #10
0
    public void ChangeItem(EventTrigger._EVENTTRIGGER eCategory, int CurrentIndex, int ChangeIndex)
    {
        List <GameObject> list = this.GetList(eCategory);

        if (list == null)
        {
            return;
        }
        GameObject gameObject  = list[CurrentIndex];
        GameObject gameObject2 = list[ChangeIndex];

        list[CurrentIndex] = gameObject2;
        list[ChangeIndex]  = gameObject;
        this.RenameItemName(eCategory, gameObject);
        this.RenameItemName(eCategory, gameObject2);
    }
コード例 #11
0
 private void EndBehavior()
 {
     foreach (GameObject current in this.BehaviorList)
     {
         Behavior component = current.GetComponent <Behavior>();
         component.bPopNext = false;
     }
     if (EventTrigger.m_DebugMode)
     {
         TsLog.Log("[{0}] End Behavior", new object[]
         {
             base.GetType().Name
         });
     }
     this._CurrentExcute = EventTrigger._EVENTTRIGGER.EndTrigger;
 }
コード例 #12
0
 private bool Excute()
 {
     EventTrigger._EVENTTRIGGER currentExcute = this._CurrentExcute;
     if (currentExcute != EventTrigger._EVENTTRIGGER.Behavior)
     {
         if (currentExcute == EventTrigger._EVENTTRIGGER.EndTrigger)
         {
             return(this.ExcuteEndTrigger());
         }
     }
     else if (!this.ExcuteBehavior())
     {
         this.StartEndTrigger();
     }
     return(true);
 }
コード例 #13
0
    public T GetItem <T>(EventTrigger._EVENTTRIGGER Category) where T : Component
    {
        List <GameObject> list = this.GetList(Category);

        if (list == null)
        {
            return((T)((object)null));
        }
        foreach (GameObject current in list)
        {
            T component = current.GetComponent <T>();
            if (component != null)
            {
                return(component);
            }
        }
        return((T)((object)null));
    }
コード例 #14
0
    public List <GameObject> GetList(EventTrigger._EVENTTRIGGER eCategory)
    {
        switch (eCategory)
        {
        case EventTrigger._EVENTTRIGGER.EventCondition:
            return(this.EventConditionList);

        case EventTrigger._EVENTTRIGGER.StateCondition:
            return(this.StateConditionList);

        case EventTrigger._EVENTTRIGGER.Behavior:
            return(this.BehaviorList);

        case EventTrigger._EVENTTRIGGER.EndTrigger:
            return(this.EndTriggerList);

        default:
            return(null);
        }
    }
コード例 #15
0
    public EventTriggerItem GetTriggerItem(EventTrigger._EVENTTRIGGER SelectTrigger, int SelectIndex)
    {
        List <GameObject> list = this.GetList(SelectTrigger);

        if (list == null)
        {
            return(null);
        }
        if (SelectIndex < 0 || list.Count <= SelectIndex)
        {
            return(null);
        }
        GameObject gameObject = list[SelectIndex];

        if (gameObject == null)
        {
            return(null);
        }
        return(gameObject.GetComponent <EventTriggerItem>());
    }
コード例 #16
0
    public List <GameObject> DeleteItem(EventTrigger._EVENTTRIGGER eCategory, GameObject Item)
    {
        List <GameObject> list = this.GetList(eCategory);

        if (list == null)
        {
            return(null);
        }
        int num = list.IndexOf(Item);

        if (list.Remove(Item))
        {
            for (int i = num; i < list.Count; i++)
            {
                this.RenameItemName(eCategory, list[i]);
            }
            return(list);
        }
        return(null);
    }
コード例 #17
0
    public int InsertItem(int index, EventTrigger._EVENTTRIGGER eCategory, GameObject Item)
    {
        List <GameObject> list = this.GetList(eCategory);

        if (list == null)
        {
            return(0);
        }
        if (list.Count <= index)
        {
            list.Add(Item);
        }
        else
        {
            list.Insert(index, Item);
        }
        for (int i = index; i < list.Count; i++)
        {
            this.RenameItemName(eCategory, list[i]);
        }
        return(list.Count);
    }
コード例 #18
0
    public void RenameItemName(EventTrigger._EVENTTRIGGER eCategory, GameObject Item)
    {
        if (Item == null)
        {
            return;
        }
        List <GameObject> list = this.GetList(eCategory);

        if (list == null)
        {
            return;
        }
        int num = list.IndexOf(Item) + 1;
        EventTriggerItem component = Item.GetComponent <EventTriggerItem>();

        if (component != null)
        {
            Item.name = num.ToString() + ". " + component.GetType().ToString();
        }
        else
        {
            Item.name = num.ToString() + ". " + Item.name;
        }
    }