Example #1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Id != 0)
            {
                hash ^= Id.GetHashCode();
            }
            if (WindowName.Length != 0)
            {
                hash ^= WindowName.GetHashCode();
            }
            if (PrefabPath.Length != 0)
            {
                hash ^= PrefabPath.GetHashCode();
            }
            if (ClassName.Length != 0)
            {
                hash ^= ClassName.GetHashCode();
            }
            if (CacheTime != 0)
            {
                hash ^= CacheTime.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Example #2
0
    /// <summary>
    /// 将AddPool特性的类自动建池,初始化构造函数
    /// </summary>
    public static void InitPool(Transform rootTrans)
    {
        if (Instance != null)
        {
            return;
        }

        Instance = new ObjectPool()
        {
            poolRootTransform = rootTrans
        };

        int count = 0;

        foreach (Type type in Utils.AllTypes)
        {
            PrefabPath poolAtr = type.GetCustomAttribute <PrefabPath>();

            if (type == typeof(ExtendPrefabBinding))
            {
                continue;
            }
            if (type.IsSubclassOf(typeof(PrefabBinding)) && poolAtr == null)
            {
                Log.Warning("{0}类继承了ObjectBinding,请为其添加PrefabPath特性来绑定一个对象", type.Name);
                continue;
            }

            if (poolAtr != null)
            {
                if (!type.IsSubclassOf(typeof(PrefabBinding)))
                {
                    Log.Warning("{0}类不是ObjectBinding的子类,PrefabPath特性无效", type.Name);
                    continue;
                }
                GameObject obj = Resources.Load <GameObject>(poolAtr.path);
                if (obj == null)
                {
                    Log.Error("未找到目标Prefeb,type:{0}, path:{1}", type.Name, poolAtr.path);
                }
                else
                {
                    count++;
                    //Log.Info("已建立对象池,type:{0} path:{1}" , type.Name , poolAtr.path);
                    Instance.AddPool(type, Resources.Load <GameObject>(poolAtr.path));
                }
            }
        }

        Log.Info("对象池初始化完成,共建立对象池{0}个", count);
    }
Example #3
0
        void PlaceObstacle(PrefabPath p, Obstacle obs, Transform obsPosition)
        {
            if (ObstacleCooldown.IsRunning)
            {
                return;
            }
            if (Resources < obs.Cost)
            {
                return;
            }

            Resources -= obs.Cost;
            TNManager.Instantiate(tno.channelID, "CreateObstacle", p.PathInResources, false, obsPosition.position, obsPosition.rotation);
        }
Example #4
0
    public override int GetHashCode()
    {
        int hash = 1;

        if (Id != 0)
        {
            hash ^= Id.GetHashCode();
        }
        if (Name.Length != 0)
        {
            hash ^= Name.GetHashCode();
        }
        if (PrefabPath.Length != 0)
        {
            hash ^= PrefabPath.GetHashCode();
        }
        if (Icon.Length != 0)
        {
            hash ^= Icon.GetHashCode();
        }
        if (IntroIcon.Length != 0)
        {
            hash ^= IntroIcon.GetHashCode();
        }
        if (IntroTime != 0F)
        {
            hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(IntroTime);
        }
        if (Time != 0F)
        {
            hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Time);
        }
        hash ^= expectGradeScale_.GetHashCode();
        hash ^= attribute_.GetHashCode();
        hash ^= param1_.GetHashCode();
        hash ^= param2_.GetHashCode();
        hash ^= param3_.GetHashCode();
        hash ^= param4_.GetHashCode();
        hash ^= param5_.GetHashCode();
        if (_unknownFields != null)
        {
            hash ^= _unknownFields.GetHashCode();
        }
        return(hash);
    }
Example #5
0
        public override Dictionary <string, object> SaveToDict()
        {
            var dict = new Dictionary <string, object>();

            dict.Add(GDMConstants.SchemaKey, "Weapon");

            dict.Merge(true, ID.ToGDEDict(IDKey));
            dict.Merge(true, MagazineSize.ToGDEDict(MagazineSizeKey));
            dict.Merge(true, ConsumePerHit.ToGDEDict(ConsumePerHitKey));
            dict.Merge(true, DamageVal.ToGDEDict(DamageValKey));
            dict.Merge(true, AtkInterval.ToGDEDict(AtkIntervalKey));
            dict.Merge(true, ChargeTime.ToGDEDict(ChargeTimeKey));
            dict.Merge(true, ReloadTime.ToGDEDict(ReloadTimeKey));
            dict.Merge(true, Thrust.ToGDEDict(ThrustKey));
            dict.Merge(true, AlertRange.ToGDEDict(AlertRangeKey));
            dict.Merge(true, PrefabPath.ToGDEDict(PrefabPathKey));
            dict.Merge(true, SkinName.ToGDEDict(SkinNameKey));

            dict.Merge(true, OpaType.ToGDEDict(OpaTypeKey));
            dict.Merge(true, AniType.ToGDEDict(AniTypeKey));
            return(dict);
        }
Example #6
0
    public string ReturnPath(ResourcsePath _rPath, PrefabPath _pPath, string _name)
    {
        string kPath = _rPath.ToString() + "/" + _pPath.ToString() + "/" + _name;

        return(kPath);
    }
        public override int GetHashCode()
        {
            int hash = 1;

            if (Priority != 0)
            {
                hash ^= Priority.GetHashCode();
            }
            if (SubcategoryId.Length != 0)
            {
                hash ^= SubcategoryId.GetHashCode();
            }
            if (IconPath.Length != 0)
            {
                hash ^= IconPath.GetHashCode();
            }
            if (ShowQuantityBanner != false)
            {
                hash ^= ShowQuantityBanner.GetHashCode();
            }
            if (QuantityOverride.Length != 0)
            {
                hash ^= QuantityOverride.GetHashCode();
            }
            if (PrefabPath.Length != 0)
            {
                hash ^= PrefabPath.GetHashCode();
            }
            if (MarketingText.Length != 0)
            {
                hash ^= MarketingText.GetHashCode();
            }
            if (DescriptionText.Length != 0)
            {
                hash ^= DescriptionText.GetHashCode();
            }
            if (ShowBadge != false)
            {
                hash ^= ShowBadge.GetHashCode();
            }
            if (BonusValue != 0)
            {
                hash ^= BonusValue.GetHashCode();
            }
            if (RarityId.Length != 0)
            {
                hash ^= RarityId.GetHashCode();
            }
            if (PackSize != 0)
            {
                hash ^= PackSize.GetHashCode();
            }
            if (ShowInHud != false)
            {
                hash ^= ShowInHud.GetHashCode();
            }
            if (HudPriority != 0)
            {
                hash ^= HudPriority.GetHashCode();
            }
            if (HudIconPath.Length != 0)
            {
                hash ^= HudIconPath.GetHashCode();
            }
            if (Icon2Path.Length != 0)
            {
                hash ^= Icon2Path.GetHashCode();
            }
            if (PopupImageOverride.Length != 0)
            {
                hash ^= PopupImageOverride.GetHashCode();
            }
            if (HidePackOnSoldOut != false)
            {
                hash ^= HidePackOnSoldOut.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Example #8
0
    public string GetPath()
    {
        PrefabPath path = (PrefabPath)PrefabPath.GetCustomAttribute(this.GetType(), typeof(PrefabPath));

        return(path.Path);
    }