Ejemplo n.º 1
0
        public void Reg(string tag, int index, GameObject go, isActive activeFunc)
        {
            if (dic.ContainsKey(tag))
            {
                List <RedPointBundle> bs = dic [tag];

                if (bs != null)
                {
                    bool find = false;
                    for (int i = 0; i < bs.Count; ++i)
                    {
                        if (bs [i].index == index)
                        {
                            find = true;
                            //Debug.LogWarning(string.Format("find index {0} exsits", index));

                            bs [i] = new RedPointBundle(tag, index, go, activeFunc);

                            break;
                        }
                    }

                    if (!find)
                    {
                        bs.Add(new RedPointBundle(tag, index, go, activeFunc));
                    }
                }
                else
                {
                    throw new System.Exception("null pointer exception");
                }
            }
            else
            {
                List <RedPointBundle> bundles = new List <RedPointBundle> ();

                RedPointBundle b = new RedPointBundle(tag, index, go, activeFunc);
                bundles.Add(b);
                dic.Add(tag, bundles);
            }
        }
Ejemplo n.º 2
0
        public void Triggle(string tag, int index)
        {
            ActiveTag(tag);
            try {
                if (dic.ContainsKey(tag))
                {
                    List <RedPointBundle> rbs = dic [tag];

                    RedPointBundle rb = null;

                    foreach (var k in rbs)
                    {
                        if (k.index == index)
                        {
                            rb = k;
                            break;
                        }
                    }

                    if (rb != null)
                    {
                        if (rb.go.gameObject)
                        {
                            rb.go.SetActive(false);
                        }
                        else
                        {
                            Debug.LogWarning(string.Format("tag {0} index {1} 's gameObject is null ,use this function after register!", tag, index));
                        }
                    }
                    else
                    {
                        //Debug.LogWarning("not find!");
                    }
                }
            } catch (System.Exception e) {
                Debug.LogError(e.ToString());
            }
            //            Debug.Log("Triggle " + tag + " " + index);
        }