コード例 #1
0
 private void SetupBaseLayout(BaseDescription baseDescription)
 {
     foreach (var obj in baseDescription.layout)
     {
         database.Instantiate(obj);
     }
 }
コード例 #2
0
        public static void WriteDefensesLayout(BaseDescription baseDesription)
        {
            var layoutObjects = UnityEngine.Object.FindObjectsOfType <LayoutObject>();
            var objectId      = 1;

            foreach (var obj in layoutObjects)
            {
                var objectIdentity = obj.GetComponent <ObjectIdentity>();
                objectIdentity.RuntimeId = objectId++;

                baseDesription.AddToLayout(objectIdentity);

                var additionalData = obj.GetComponent <AdditionalDataProvider>();
                if (additionalData != null)
                {
                    baseDesription.AddAdditionalData(additionalData);
                }
            }

            //In case some objects have dependencies on each other, destroy them afterwards
            foreach (var layoutObject in layoutObjects)
            {
                UnityEngine.Object.DestroyImmediate(layoutObject.gameObject);
            }
        }
コード例 #3
0
        protected virtual bool ShouldBuildDescription(BaseDescription description)
        {
            if (description == null)
            {
                return(false);
            }

            if (!string.IsNullOrEmpty(description.NotFor))
            {
                var notFor = description.NotFor.Split(';');
                if (notFor.Any(_platformTags.ContainsKey))
                {
                    return(false);
                }
            }

            if (!string.IsNullOrEmpty(description.OnlyFor))
            {
                var onlyFor = description.OnlyFor.Split(';');
                if (onlyFor.Any(_platformTags.ContainsKey))
                {
                    return(true);
                }

                return(false);
            }

            return(true);
        }
コード例 #4
0
ファイル: BaseAuto.cs プロジェクト: Everbridge/sm-MvvmCross
 protected void Fill(BaseDescription baseDescription)
 {
     foreach (var kvp in Properties)
     {
         baseDescription.Properties[kvp.Key] = kvp.Value;
     }
     baseDescription.OnlyFor = OnlyFor;
     baseDescription.NotFor  = NotFor;
 }
コード例 #5
0
        private void SetupAdditionalData(BaseDescription baseDescription)
        {
            foreach (var data in baseDescription.additionalData)
            {
                var obj            = database.GetByRuntimeId(data.objectRuntimeId);
                var additionalData = obj.GetComponent <AdditionalDataProvider>();

                additionalData.InitFromString(data.data);
            }
        }
コード例 #6
0
        private static BaseProperties FromProperties(BaseDescription baseDescription)
        {
            var baseProperties = Selection.activeObject as BaseProperties;

            baseDescription.goldMiningLimit   = baseProperties.goldMiningLimit;
            baseDescription.goldMiningStarted = DateTime.MinValue.ToBinary();

            baseDescription.omoniumVeinsMax      = baseProperties.omoniumVeinsMax;
            baseDescription.omoniumVeinsLeft     = baseProperties.omoniumVeinsMax;
            baseDescription.omoniumMiningStarted = DateTime.MinValue.ToBinary();

            baseDescription.availableDefenses = baseProperties.availableDefenses.ToArray();
            return(baseProperties);
        }
コード例 #7
0
    private BaseDescription findClosest(IEnumerable <BaseDescription> list)
    {
        BaseDescription closest = null;

        foreach (var eon in list)
        {
            if (closest == null || distance(Description, eon) < distance(Description, closest))
            {
                closest = eon;
            }
        }

        return(closest);
    }
コード例 #8
0
ファイル: Hive.cs プロジェクト: CheessieStew/crispy-potato
 public void Notify(BaseDescription desc)
 {
     if (!knownObjects.ContainsKey(desc.GenericName))
     {
         knownObjects.Add(desc.GenericName, new Dictionary <int, BaseDescription>());
     }
     if (!knownObjects[desc.GenericName].ContainsKey(desc.EntityID))
     {
         knownObjects[desc.GenericName].Add(desc.EntityID, desc);
     }
     else
     {
         knownObjects[desc.GenericName][desc.EntityID] = desc;
     }
 }
コード例 #9
0
        public static void BuildBase()
        {
            var            baseDescription = new BaseDescription();
            BaseProperties baseProperties  = FromProperties(baseDescription);

            //TODO populate layout and upgrades
            WriteDefensesLayout(baseDescription);

            //TODO automatically assing asset bundle names to corresponding assets

            var manifest   = BuildPipeline.BuildAssetBundles(Constants.AssetBundlesPath, BuildAssetBundleOptions.None, BuildTarget.Android);
            var bundleName = manifest.GetAllAssetBundles()[0];

            baseDescription.bundleName = bundleName;

            baseProperties.provider.UpdatePlayerBase(baseProperties.playerId.ToString(), baseDescription);
        }
コード例 #10
0
ファイル: SalesOrderDAL.cs プロジェクト: cfmis/vncf
        //返回客戶中英文描述
        public static BaseDescription GetCustomerByID(string strCustomerID)
        {
            string          strSql   = string.Format("Select name,english_name FROM dbo.bs_customer with(nolock) Where id='{0}' and state <>'2'", strCustomerID);
            DataTable       dt       = SQLHelper.ExecuteSqlReturnDataTable(strSql);
            BaseDescription objModel = new BaseDescription();

            if (dt.Rows.Count > 0)
            {
                objModel.Cdesc = dt.Rows[0]["name"].ToString();
                objModel.Edesc = dt.Rows[0]["english_name"].ToString();
            }
            else
            {
                objModel.Cdesc = "";
                objModel.Edesc = "";
            }
            return(objModel);
        }
コード例 #11
0
ファイル: PurchaseDAL.cs プロジェクト: cfmis/vncf
        //返回附加費中英文描述
        public static BaseDescription GetOtherFareByID(string strFareID)
        {
            string          strSql   = string.Format(@"Select name,english_name FROM bs_tack_fare with(nolock) WHERE id='{0}' and use_buy = '1' AND state='0'", strFareID);
            DataTable       dt       = SQLHelper.ExecuteSqlReturnDataTable(strSql);
            BaseDescription objModel = new BaseDescription();

            if (dt.Rows.Count > 0)
            {
                objModel.Cdesc = dt.Rows[0]["name"].ToString();
                objModel.Edesc = dt.Rows[0]["english_name"].ToString();
            }
            else
            {
                objModel.Cdesc = "";
                objModel.Edesc = "";
            }
            return(objModel);
        }
コード例 #12
0
ファイル: SalesOrderDAL.cs プロジェクト: cfmis/vncf
        //返回貨品中英文描述
        public static BaseDescription GetProductByID(string strProductID)
        {
            string          strSql   = string.Format(@"Select name,english_name FROM {0}it_goods with(nolock) Where id='{1}' and state <>'2'", strRemoteDB, strProductID);
            DataTable       dt       = SQLHelper.ExecuteSqlReturnDataTable(strSql);
            BaseDescription objModel = new BaseDescription();

            if (dt.Rows.Count > 0)
            {
                objModel.Cdesc = dt.Rows[0]["name"].ToString();
                objModel.Edesc = dt.Rows[0]["english_name"].ToString();
            }
            else
            {
                objModel.Cdesc = "";
                objModel.Edesc = "";
            }
            return(objModel);
        }
コード例 #13
0
        public async Task BuildBase(BaseDescription baseDescription)
        {
            var bundle = await AssetBundle.LoadFromFileAsync(Path.Combine(Constants.AssetBundlesPath, baseDescription.bundleName));

            using (var disposable = new DisposableBundle(bundle)) {
                var sceneName = Path.GetFileNameWithoutExtension(disposable.GetAllScenePaths()[0]);

                await Scenes.LoadBaseScene(sceneName);

                SetupBaseLayout(baseDescription);
                SetupUpgrades(baseDescription);
                SetupAdditionalData(baseDescription);

                if (baseDescription.isAttacking)
                {
                    SpawnPlayerSpaceship();
                }

                onBaseBuilt.Raise(baseDescription);
            }
        }
コード例 #14
0
                static (string friendlyNameAttribute, string descriptionAttribute) CreateFriendlyNameAndDescriptionAttributes(BaseDescription description)
                {
                    var friendlyNameAttribute = description.FriendlyName == null
                        ? string.Empty
                        : $@"[FriendlyName(""{description.FriendlyName}"")]{Environment.NewLine}";
                    var descriptionAttribute = description.Description == null
                        ? string.Empty
                        : $@"[Description(""{description.Description}"")]{Environment.NewLine}";

                    return(friendlyNameAttribute, descriptionAttribute);
                }
コード例 #15
0
    private double distance(BaseDescription a, BaseDescription b)
    {
        double dx = a.xCoord - b.xCoord, dy = a.yCoord - b.yCoord;

        return(Math.Sqrt(dx * dx + dy * dy));
    }
コード例 #16
0
 private async Task InitNewPlayer(BaseDescription baseDescription)
 {
     Tutorials.TutorialUtility.SetTutorialRunning(true);
     await baseProvider.UpdatePlayerBase(playerData.Id, baseDescription);
 }
コード例 #17
0
 private bool canInteract(BaseDescription target)
 {
     return(distance(target, Description) - Description.Size - target.Size <= rules.MaxInteractionDistance);
 }
コード例 #18
0
    private double distance(BaseDescription a, int xCoord, int yCoord)
    {
        double dx = a.xCoord - xCoord, dy = a.yCoord - yCoord;

        return(Math.Sqrt(dx * dx + dy * dy));
    }
コード例 #19
0
 public void OnBaseBuilt(BaseDescription baseDescription)
 {
     currentBaseDescription = baseDescription;
 }
コード例 #20
0
 private void SetupUpgrades(BaseDescription baseDescription)
 {
 }