예제 #1
0
        // 穿上装备
        public bool PutOnEquip(Item equip)
        {
            var env = equip.GetEnv();

            if (env != null)
            {
                LogCat.error(string.Format("PutOnEquip error:{0} still in {1}", equip, env));
                return(false);
            }

            var list = this.oEquips.GetEquips_ToEdit();

            if (list.Contains(equip))
            {
                LogCat.error(string.Format("PutOnEquip error:{0} already put on {1}", this, equip));
                return(false);
            }

            if (!(this.OnPutOnEquip(equip) && equip.OnPutOnEquip(this)))
            {
                return(false);
            }

            equip.SetEnv(this);
            equip.SetIsPutOn(true);
            list.Add(equip);
            return(true);
        }
예제 #2
0
        //镶入镶物
        public bool EmbedOn(Item embed)
        {
            var env = embed.GetEnv();

            if (env != null)
            {
                LogCat.error(string.Format("{0} still in {1}", embed, env));
                return(false);
            }

            var list = this.oEmbeds.GetEmbeds_ToEdit();

            if (list.Contains(embed))
            {
                LogCat.error(string.Format("{0} already embed on {1}", this, embed));
                return(false);
            }

            if (!(this.OnEmbedOn(embed) && embed.OnEmbedOn(this)))
            {
                return(false);
            }

            embed.SetEnv(this);
            list.Add(embed);
            return(true);
        }
예제 #3
0
파일: User_Roles.cs 프로젝트: uiopsczc/Test
        public bool AddRole(Role role)
        {
            var env = role.GetEnv();

            if (env != null)
            {
                LogCat.error(string.Format("{0} still in {1}", role, env));
                return(false);
            }

            var list = this.oRoles.GetRoles_ToEdit();

            if (list.Contains(role))
            {
                LogCat.error(string.Format("{0} already has role:{1}", this, role));
                return(false);
            }

            if (!(this.OnAddRole(role) && role.OnAddRole(this)))
            {
                return(false);
            }

            role.SetEnv(this);
            list.Add(role);
            return(true);
        }
예제 #4
0
    [MenuItem(CZMToolConst.Menu_Root + "GroupGameObjects/Group打包(解除Group) %&g")]     //crtl+alt+g
    public static void GroupGameObject_DisGroup()
    {
        Object[] selectedObjects = Selection.objects;

        GameObject groupGameObject = selectedObjects[0] as GameObject;

        List <Transform> childrenTransformList = new List <Transform>();

        for (int i = 0; i < groupGameObject.transform.childCount; i++)
        {
            childrenTransformList.Add(groupGameObject.transform.GetChild(i));
        }

        Vector3 min = Vector3Const.Max;
        Vector3 max = Vector3Const.Min;

        GetMinMax(groupGameObject.transform, ref min, ref max);
        if (max == Vector3Const.Max)
        {
            LogCat.error("没有Meshes");
            return;
        }


        groupGameObject.transform.DetachChildren();

        groupGameObject.transform.position = (min + max) / 2;

        foreach (Transform transform in childrenTransformList)
        {
            transform.parent = groupGameObject.transform;
        }

        LogCat.log("GroupGameObjects finished");
    }
예제 #5
0
 private void __CounterFunc()
 {
     if (this.counter.count < 0)
     {
         LogCat.error("counter.count < 0");
     }
     if (this.counter.count == 0 && this.isSpellAnimationFinished && !this.IsDestroyed())
     {
         this.RemoveSelf();
     }
 }
예제 #6
0
        public bool UseItem(Item item)
        {
            var env = item.GetEnv();

            if (env != null)
            {
                LogCat.error(string.Format("UseItem error:{0} still in {1}", item, env));
                return(false);
            }

            return(this.OnUseItem(item) && item.OnUseItem(this));
        }
예제 #7
0
    [MenuItem(CZMToolConst.Menu_Root + "GroupGameObjects/Group打包(中心) %g")]     //crtl+g
    public static void GroupGameObject_Center()
    {
        Object[]         selectedObjects = Selection.objects;
        List <Transform> transformList   = new List <Transform>();

        foreach (GameObject gameObject1 in selectedObjects)
        {
            bool isNeedToAdd = true;
            foreach (GameObject gameObject2 in selectedObjects)
            {
                if (gameObject1.transform.parent == gameObject2.transform)
                {
                    isNeedToAdd = false;
                    break;
                }
            }

            if (isNeedToAdd)
            {
                transformList.Add(gameObject1.transform);
            }
        }

        Vector3 min = Vector3Const.Max;
        Vector3 max = Vector3Const.Min;

        foreach (Transform transform in transformList)
        {
            GetMinMax(transform, ref min, ref max);
        }


        if (max == Vector3Const.Max)
        {
            LogCat.error("没有Meshes");
            return;
        }

        GameObject group = new GameObject();

        group.name = "Group";
        group.transform.position = (min + max) / 2;

        foreach (Transform transform in transformList)
        {
            transform.parent = group.transform;
        }

        LogCat.log("GroupGameObjects finished");
    }
예제 #8
0
        public void RegisterListener(string type, Unit unit, object obj, string tag, MethodInvoker methodInvoker)
        {
            if (!this.listenerDict.ContainsKey(type))
            {
                LogCat.error("Register Listener with undefine type()!", type);
                return;
            }

            var spellListenerInfo = new SpellListenerInfo();

            spellListenerInfo.type          = type;
            spellListenerInfo.unit          = unit;
            spellListenerInfo.obj           = obj;
            spellListenerInfo.tag           = tag;
            spellListenerInfo.methodInvoker = methodInvoker;
            this.listenerDict[type].Add(spellListenerInfo);
        }
예제 #9
0
        public void UnRegisterListener(string type, Unit unit, object obj, string tag)
        {
            if (!this.listenerDict.ContainsKey(type))
            {
                LogCat.error("Unregister Listener with undefine type()!", type);
                return;
            }

            for (int i = this.listenerDict[type].Count - 1; i >= 0; i--)
            {
                var listenerInfo = this.listenerDict[type][i];
                if (listenerInfo.unit == unit && listenerInfo.obj == obj && ObjectUtil.Equals(listenerInfo.tag, tag))
                {
                    this.listenerDict[type].RemoveAt(i);
                    break;
                }
            }
        }
예제 #10
0
        //卸下镶物
        public bool EmbedOff(Item embed)
        {
            var list = this.oEmbeds.GetEmbeds_ToEdit();

            if (!list.Contains(embed))
            {
                LogCat.error(string.Format("{0} not contains embed:{1}", this, embed));
                return(false);
            }

            if (!(this.OnEmbedOff(embed) && embed.OnEmbedOff(this)))
            {
                return(false);
            }

            list.Remove(embed);
            embed.SetEnv(null);
            return(true);
        }
예제 #11
0
파일: User_Roles.cs 프로젝트: uiopsczc/Test
        public bool RemoveRole(Role role)
        {
            var list = this.oRoles.GetRoles_ToEdit();

            if (!list.Contains(role))
            {
                LogCat.error(string.Format("{0} not contains role:{1}", this, role));
                return(false);
            }

            if (!(this.OnRemoveRole(role) && role.OnRemoveRole(this)))
            {
                return(false);
            }

            list.Remove(role);
            role.SetEnv(null);
            return(true);
        }
예제 #12
0
        public virtual bool TakeOffEquip(Item equip)
        {
            var list = this.oEquips.GetEquips_ToEdit();

            if (!list.Contains(equip))
            {
                LogCat.error(string.Format("TakeOffEquip error:{0} not contains equip:{1}", this, equip));
                return(false);
            }

            if (!(this.OnTakeOffEquip(equip) && equip.OnTakeOffEquip(this)))
            {
                return(false);
            }
            list.Remove(equip);
            equip.SetIsPutOn(false);
            equip.SetEnv(null);
            return(true);
        }
예제 #13
0
파일: User_Roles.cs 프로젝트: uiopsczc/Test
        public Role RemoveRole(string idOrRid, bool isNotNeedDestruct = false)
        {
            Role role = GetRole(idOrRid);

            if (role == null)
            {
                LogCat.error(string.Format("{0} do not contain role:{1}", this, role));
                return(null);
            }

            if (!this.CheckRemoveRole(role))
            {
                return(null);
            }
            if (!this.RemoveRole(role))
            {
                return(null);
            }
            if (!isNotNeedDestruct)
            {
                role.Destruct();
            }
            return(role);
        }
예제 #14
0
        public static void Test()
        {
            var t = ArrayCat.New("tttt", false, 4);

            LogCat.error(t.data1);
        }