示例#1
0
        public void LoadAsset(AssetInfo asset)
        {
#if !UnitTest
            if (Logger.IsDebugEnabled)
            {
                Logger.DebugFormat("LoadAsset {0}", asset);
            }
#endif
            if (!_loadKeys.ContainsKey(asset))
            {
                var loadKey = new LoadKey();
                _loadKeys[asset] = loadKey;
                _assetManager.LoadAssetAsync("WeaponModelLoader", asset, OnLoadSucc);
            }
        }
示例#2
0
        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            output.SetNgFor(AngBind, "ng-bind")
            .SetNgFor(AngClass, "ng-class")
            .SetNgFor(AngIf, "ng-if")
            .SetNgFor(AngShow, "ng-show")
            .SetNgFor(AngHide, "ng-hide")
            .SetNgFor(AngIdentifierScope, "target-scope");


            if (Swapable != null)
            {
                output.Attributes.SetAttribute("swapable", null);
            }
            if (SwapIndex != null)
            {
                output.Attributes.SetAttribute("Swap-index", SwapIndex);
            }

            string loadingUrl = "";

            if (LoadRoute != null)
            {
                loadingUrl = urlHelperFactory.GetUrlHelper(ViewContext).Content(LoadRoute);
            }

            if (LoadKey != null)
            {
                loadingUrl += "{{" + LoadKey.GetName() + "}}";
                loadingUrl  = $"{LoadPrefix}{loadingUrl}{LoadSuffix}";
            }
            if (loadingUrl != "")
            {
                output.Attributes.SetAttribute("load-url", loadingUrl);
            }

            if (LoadOnSwap != null)
            {
                output.Attributes.SetAttribute("load-on-swap", LoadOnSwap.ToString().ToLower());
            }

            if (AngIdentifier != null)
            {
                output.Attributes.SetAttribute("listening-root-key", AngIdentifier);
            }
            //if (AngRepeatIdentifier != null)
            //    output.Attributes.SetAttribute("listening-root-key", AngRepeatIdentifier + "{{$index}}");

            if (AngRepeat != null)
            {
                string repStr = AngRepeat.GetName();
                if (AngRepeatTo != null)
                {
                    repStr = $"{AngRepeatTo.GetName()} in {repStr}";
                }
                else if (repStr.EndsWith('s'))
                {
                    repStr = $"{repStr.Substring(0, repStr.Length - 1)} in {repStr}";
                }
                else
                {
                    repStr = $"single in {repStr}";
                }
                output.Attributes.SetAttribute("ng-repeat", repStr);
            }

            if (AngData != null)
            {
                string uid = Guid.NewGuid().ToString("N");

                angularService.Pairs.Add(uid, AngData.Model);
                output.Attributes.SetAttribute("netcore-angular-set", uid);
                output.Attributes.SetAttribute("set-to-scope", AngData.GetName());
            }
            else
            {
                string uid = Guid.NewGuid().ToString("N");

                if (AngSource != null)
                {
                    angularService.Pairs.Add(uid, AngSource);
                    output.Attributes.SetAttribute("netcore-angular-set", uid);
                }

                if (AngScopeDest != null)
                {
                    output.Attributes.SetAttribute("set-to-scope", AngScopeDest);
                }
                else if (AngDestination != null)
                {
                    output.Attributes.SetAttribute("set-to-scope", AngDestination.GetName());
                }
            }
        }