Пример #1
0
        bool LoadProp(GetGamedataFile.PropObject PropObj)
        {
            if (!PaintPropObjects.Contains(PropObj))
            {
                PaintPropObjects.Add(PropObj);

                GameObject NewPropListObject = Instantiate(PaintPropListObject, PaintPropPivot) as GameObject;
                PropData   pb = NewPropListObject.GetComponent <PropData>();
                pb.SetPropPaint(PaintPropObjects.Count - 1, PropObj.BP.Name);
                PaintButtons.Add(pb);
                return(true);
            }
            return(false);
        }
Пример #2
0
        /// <summary>
        /// Called by the framework when the component needs to be rendered as HTML.
        /// </summary>
        /// <param name="model">The model being rendered by the component.</param>
        /// <returns>The component rendered as HTML.</returns>
        public async Task <string> RenderAsync(DateTime?model)
        {
            UseSuppliedIdAsControlId();

            HtmlBuilder hb = new HtmlBuilder();

            hb.Append($"<div id='{ControlId}' class='yt_date t_edit'>");

            Dictionary <string, object> hiddenAttributes = new Dictionary <string, object>(HtmlAttributes)
            {
                { "__NoTemplate", true }
            };

            hb.Append(await HtmlHelper.ForEditComponentAsync(Container, PropertyName, null, "Hidden", HtmlAttributes: hiddenAttributes, Validation: Validation));

            YTagBuilder tag = new YTagBuilder("input");

            FieldSetup(tag, FieldType.Anonymous);
            tag.Attributes.Add("name", "dtpicker");

            // handle min/max date
            DateSetup setup = new DateSetup {
                Min = new DateTime(1900, 1, 1),
                Max = new DateTime(2199, 12, 31),
            };
            MinimumDateAttribute minAttr = PropData.TryGetAttribute <MinimumDateAttribute>();

            if (minAttr != null)
            {
                setup.Min = minAttr.MinDate;
            }
            MaximumDateAttribute maxAttr = PropData.TryGetAttribute <MaximumDateAttribute>();

            if (maxAttr != null)
            {
                setup.Max = maxAttr.MaxDate;
            }

            if (model != null)
            {
                tag.MergeAttribute("value", Formatting.FormatDateTime((DateTime)model));// shows date using user's time zone
            }
            hb.Append(tag.ToString(YTagRenderMode.StartTag));

            hb.Append($"</div>");

            Manager.ScriptManager.AddLast($@"new YetaWF_ComponentsHTML.DateEditComponent('{ControlId}', {Utility.JsonSerialize(setup)});");

            return(hb.ToString());
        }
        private void WriteBlnResponse(string requestPath,
                                      PropData data,
                                      Stream outputStream)
        {
            INode node = new SvnBlnNode(requestPath, int.Parse(requestPath.Substring(10)));

            using (StreamWriter writer = new StreamWriter(outputStream))
            {
                writer.Write("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
                writer.Write("<D:multistatus xmlns:D=\"DAV:\" xmlns:ns0=\"DAV:\">\n");
                WriteProperties(node, data.Properties, writer);
                writer.Write("</D:multistatus>\n");
            }
        }
Пример #4
0
        private void AddValidation(YTagBuilder tagBuilder)
        {
            //$$$ // add some default validations
            //if (!PropData.ReadOnly) {
            //    if (PropData.PropInfo.PropertyType == typeof(DateTime) || PropData.PropInfo.PropertyType == typeof(DateTime?)) {
            //        tagBuilder.Attributes["data-val-date"] = __ResStr("valDate", "Please enter a valid value for field '{0}'", PropData.GetCaption(Container));
            //        tagBuilder.MergeAttribute("data-val", "true");
            //    } else if (PropData.PropInfo.PropertyType == typeof(int) || PropData.PropInfo.PropertyType == typeof(int?) ||
            //            PropData.PropInfo.PropertyType == typeof(long) || PropData.PropInfo.PropertyType == typeof(long?)) {
            //        tagBuilder.Attributes["data-val-number"] = __ResStr("valNumber", "Please enter a valid number for field '{0}'", PropData.GetCaption(Container));
            //        tagBuilder.MergeAttribute("data-val", "true");
            //    }
            //}
            // Build validation attribute
            List <object> objs = new List <object>();

            foreach (YIClientValidation val in PropData.ClientValidationAttributes)
            {
                // TODO: GetCaption can fail for redirects (ModuleDefinition) so we can't call it when there are no validation attributes
                // GridAllowedRole and GridAllowedUser use a ResourceRedirectList with a property OUTSIDE of the model. This only works in grids (where it is used)
                // but breaks when used elsewhere (like here) so we only call GetCaption if there is a validation attribute (FOR NOW).
                // That whole resource  redirect business needs to be fixed (old and ugly, and fragile).
                string         caption = PropData.GetCaption(Container);
                ValidationBase valBase = val.AddValidation(Container, PropData, caption, tagBuilder);
                if (valBase != null)
                {
                    string method = valBase.Method;
                    if (string.IsNullOrWhiteSpace(method))
                    {
                        throw new InternalError($"No method given ({nameof(ValidationBase)}.{nameof(ValidationBase.Method)})");
                    }
                    if (string.IsNullOrWhiteSpace(valBase.Message))
                    {
                        throw new InternalError($"No message given ({nameof(ValidationBase)}.{nameof(ValidationBase.Message)})");
                    }
                    objs.Add(valBase);
                    method         = method.TrimEnd("Attribute");  // remove ending ..Attribute
                    method         = method.TrimEnd("Validation"); // remove ending ..Validation
                    valBase.Method = method.ToLower();
                    if (string.IsNullOrWhiteSpace(method))
                    {
                        throw new InternalError($"No method name found after removing Attribute and Validation suffixes");
                    }
                }
            }
            if (objs.Count > 0)
            {
                tagBuilder.Attributes.Add("data-v", Utility.JsonSerialize(objs));
            }
        }
    public void AddProp(string prop)
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("WeeklySignScript_hotfix", "AddProp"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.WeeklySignScript_hotfix", "AddProp", null, prop);
            return;
        }

        List <string> list = new List <String>();

        CommonUtil.splitStr(prop, list, ';');
        for (int i = 0; i < list.Count; i++)
        {
            string[] strings = list[i].Split(':');
            int      propId  = Convert.ToInt32(strings[0]);
            int      propNum = Convert.ToInt32(strings[1]);
            if (propId == 1)
            {
                UserData.gold += propNum;
            }
            else if (propId == 2)
            {
                UserData.yuanbao += propNum;
            }
            else
            {
                var userPropData = new UserPropData();
                userPropData.prop_id  = propId;
                userPropData.prop_num = propNum;

                for (int j = 0; j < PropData.getInstance().getPropInfoList().Count; j++)
                {
                    PropInfo propInfo = PropData.getInstance().getPropInfoList()[j];
                    if (propInfo.m_id == userPropData.prop_id)
                    {
                        userPropData.prop_icon = propInfo.m_icon;
                        userPropData.prop_name = propInfo.m_name;
                    }
                }
                UserData.propData.Add(userPropData);
            }

            if (OtherData.s_mainScript != null)
            {
                OtherData.s_mainScript.refreshUI();
                OtherData.s_mainScript.checkRedPoint();
            }
        }
    }
Пример #6
0
        /// <summary>
        /// Called by the framework when the component needs to be rendered as HTML.
        /// </summary>
        /// <param name="model">The model being rendered by the component.</param>
        /// <returns>The component rendered as HTML.</returns>
        public async Task <string> RenderAsync(SerializableList <ModuleDefinition.ReferencedModule> model)
        {
            HtmlBuilder hb = new HtmlBuilder();

            if (model == null)
            {
                model = new SerializableList <ModuleDefinition.ReferencedModule>();
            }

            bool header = PropData.GetAdditionalAttributeValue("Header", true);

            GridModel grid = new GridModel()
            {
                GridDef = GetGridModel(header)
            };

            grid.GridDef.DirectDataAsync = async(int skip, int take, List <DataProviderSortInfo> sorts, List <DataProviderFilterInfo> filters) => {
                List <AddOnManager.Module> allMods = Manager.AddOnManager.GetUniqueInvokedCssModules();

                List <Entry> mods = new List <Entry>();
                foreach (AddOnManager.Module allMod in allMods)
                {
                    ModuleDefinition modDef = await ModuleDefinition.CreateUniqueModuleAsync(allMod.ModuleType);

                    if (modDef != null)
                    {
                        mods.Add(new Entry {
                            Name          = modDef.Name,
                            Description   = modDef.Description,
                            PermanentName = modDef.PermanentModuleName,
                            ModuleGuid    = modDef.ModuleGuid,
                            UsesModule    = (from m in model where m.ModuleGuid == allMod.ModuleGuid select m).FirstOrDefault() != null
                        });
                    }
                }
                DataSourceResult data = new DataSourceResult {
                    Data  = mods.ToList <object>(),
                    Total = mods.Count,
                };
                return(data);
            };

            hb.Append($@"
<div class='yt_invokedmodules t_edit' id='{DivId}'>
    {await HtmlHelper.ForDisplayAsAsync(Container, PropertyName, FieldName, grid, nameof(grid.GridDef), grid.GridDef, "Grid", HtmlAttributes: HtmlAttributes)}
</div>");

            return(hb.ToString());
        }
Пример #7
0
    static private void SetPropDataFieldValue(PropData propData, string fieldName, string fieldValueString)
    {
        // What extension of PropData is this?
        Type propDataType = propData.GetType();
        // Get the FieldInfo of the requested name from this propData's class.
        FieldInfo fieldInfo = propDataType.GetField(fieldName);

        // Get the VALUE of this field from the string!
        if (fieldInfo == null)
        {
            Debug.LogError("We've been provided an unidentified prop field type. " + debug_roomDataLoadingRoomKey + ". PropData: " + propData + ", fieldName: " + fieldName);
        }
        else if (fieldInfo.FieldType == typeof(bool))
        {
            fieldInfo.SetValue(propData, bool.Parse(fieldValueString));
        }
        else if (fieldInfo.FieldType == typeof(float))
        {
            fieldInfo.SetValue(propData, TextUtils.ParseFloat(fieldValueString));
        }
        else if (fieldInfo.FieldType == typeof(int))
        {
            fieldInfo.SetValue(propData, TextUtils.ParseInt(fieldValueString));
        }
        else if (fieldInfo.FieldType == typeof(string))
        {
            fieldInfo.SetValue(propData, fieldValueString);
        }
        else if (fieldInfo.FieldType == typeof(Rect))
        {
            fieldInfo.SetValue(propData, TextUtils.GetRectFromString(fieldValueString));
        }
        else if (fieldInfo.FieldType == typeof(Vector2))
        {
            fieldInfo.SetValue(propData, TextUtils.GetVector2FromString(fieldValueString));
        }
        else if (fieldInfo.FieldType == typeof(OnOfferData))
        {
            fieldInfo.SetValue(propData, OnOfferData.FromString(fieldValueString));
        }
        else if (fieldInfo.FieldType == typeof(TravelMindData))
        {
            fieldInfo.SetValue(propData, TravelMindData.FromString(fieldValueString));
        }
        else
        {
            Debug.LogWarning("Unrecognized field type in Room file: " + debug_roomDataLoadingRoomKey + ". PropData: " + propData + ", fieldName: " + fieldName);
        }
    }
Пример #8
0
        public async Task <string> RenderAsync(List <string> model)
        {
            HtmlBuilder hb = new HtmlBuilder();

            bool header = PropData.GetAdditionalAttributeValue("Header", true);

            GridModel grid = new GridModel()
            {
                GridDef = GetGridModel(header)
            };

            grid.GridDef.DirectDataAsync = (int skip, int take, List <DataProviderSortInfo> sorts, List <DataProviderFilterInfo> filters) => {
                List <Entry> list = new List <Entry>();
                if (model != null)
                {
                    list = (from u in model select new Entry(u)).ToList();
                }
                return(Task.FromResult(new DataSourceResult {
                    Data = list.ToList <object>(),
                    Total = list.Count
                }));
            };

            hb.Append($@"
<div class='yt_yetawf_devtests_listofemailaddresses t_edit' id='{DivId}'>
    {await HtmlHelper.ForDisplayAsAsync(Container, PropertyName, FieldName, grid, nameof(grid.GridDef), grid.GridDef, "Grid", HtmlAttributes: HtmlAttributes)}");

            using (Manager.StartNestedComponent(FieldName)) {
                NewModel newModel = new NewModel();
                hb.Append($@"
    <div class='t_newvalue'>
        {await HtmlHelper.ForLabelAsync(newModel, nameof(newModel.NewValue))}
        {await HtmlHelper.ForEditAsync(newModel, nameof(newModel.NewValue))}
        <input name='btnAdd' type='button' value='Add' disabled='disabled' />
    </div>");
            }

            ListOfEmailAddressesSetup setup = new ListOfEmailAddressesSetup {
                AddUrl = GetSiblingProperty <string>($"{PropertyName}_AjaxUrl"),
                GridId = grid.GridDef.Id,
            };

            hb.Append($@"
</div>");

            Manager.ScriptManager.AddLast($@"new YetaWF_DevTests.ListOfEmailAddressesEditComponent('{DivId}', {Utility.JsonSerialize(setup)});");

            return(hb.ToString());
        }
Пример #9
0
    // ----------------------------------------------------------------
    //  Initialize
    // ----------------------------------------------------------------
    virtual protected void InitializeAsProp(Room myRoom, PropData data)
    {
        this.MyRoom = myRoom;
        GameUtils.ParentAndReset(this.gameObject, myRoom.transform);

        this.transform.localPosition = data.pos;         // note that this is just a convenience default. Any grounds will set their pos from their rect.
        rotation = data.rotation;
        if (data.travelMind.IsUsed)
        {
            AddTravelMind(data.travelMind);
        }

        IsInitialized      = true;
        FrameCountWhenBorn = Time.frameCount;
    }
Пример #10
0
        public async Task <string> RenderAsync(SerializableList <User> model)
        {
            HtmlBuilder hb = new HtmlBuilder();

            bool header  = PropData.GetAdditionalAttributeValue("Header", true);
            bool pager   = PropData.GetAdditionalAttributeValue("Pager", true);
            bool useSkin = PropData.GetAdditionalAttributeValue("UseSkinFormatting", true);

            GridModel grid = new GridModel()
            {
                GridDef = GetGridModel(header, pager, useSkin)
            };

            grid.GridDef.DirectDataAsync = async(int skip, int take, List <DataProviderSortInfo> sorts, List <DataProviderFilterInfo> filters) => {
                List <Entry> list = new List <Entry>();
                using (UserDefinitionDataProvider userDP = new UserDefinitionDataProvider()) {
                    if (model != null)
                    {
                        foreach (User user in model)
                        {
                            UserDefinition userDef = await userDP.GetItemByUserIdAsync(user.UserId);

                            string userName;
                            if (userDef == null)
                            {
                                userName = __ResStr("noUser", "({0})", user.UserId);
                            }
                            else
                            {
                                userName = userDef.UserName;
                            }
                            list.Add(new Entry(userName));
                        }
                    }
                }
                return(new DataSourceResult {
                    Data = list.ToList <object>(),
                    Total = list.Count
                });
            };

            hb.Append($@"
<div class='yt_yetawf_identity_listofusernames t_display'>
    {await HtmlHelper.ForDisplayAsAsync(Container, PropertyName, FieldName, grid, nameof(grid.GridDef), grid.GridDef, "Grid", HtmlAttributes: HtmlAttributes)}
</div>");

            return(hb.ToString());
        }
        private void WriteVccResponse(TFSSourceControlProvider sourceControlProvider,
                                      string requestPath,
                                      string label,
                                      PropData data,
                                      Stream outputStream)
        {
            INode node = new SvnVccDefaultNode(sourceControlProvider, requestPath, label, 0);

            using (StreamWriter writer = new StreamWriter(outputStream))
            {
                writer.Write("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
                writer.Write("<D:multistatus xmlns:D=\"DAV:\" xmlns:ns0=\"DAV:\">\n");
                WriteProperties(node, data.Properties, writer);
                writer.Write("</D:multistatus>\n");
            }
        }
Пример #12
0
        /// <summary>
        /// Called by the framework when the component needs to be rendered as HTML.
        /// </summary>
        /// <param name="model">The model being rendered by the component.</param>
        /// <returns>The component rendered as HTML.</returns>
        public async Task <string> RenderAsync(ModuleAction model)
        {
            using (Manager.StartNestedComponent(FieldName)) {
                HtmlBuilder hb = new HtmlBuilder();

                ModuleAction.RenderModeEnum render = PropData.GetAdditionalAttributeValue("RenderAs", ModuleAction.RenderModeEnum.Button);
                if (model != null)
                {
                    hb.Append($@"
<div class='yt_moduleaction t_display'>
    {await model.RenderAsync(render)}
</div>");
                }
                return(hb.ToString());
            }
        }
Пример #13
0
    public void onReceive_GetUserBag(string data)
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("BagPanelScript_hotfix", "onReceive_GetUserBag"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.BagPanelScript_hotfix", "onReceive_GetUserBag", null, data);
            return;
        }

        {
            JsonData jsonData = JsonMapper.ToObject(data);
            var      code     = (int)jsonData["code"];
            if (code == (int)Consts.Code.Code_OK)
            {
                UserData.propData = JsonMapper.ToObject <List <UserPropData> >(jsonData["prop_list"].ToString());
                for (int i = 0; i < PropData.getInstance().getPropInfoList().Count; i++)
                {
                    PropInfo propInfo = PropData.getInstance().getPropInfoList()[i];
                    for (int j = 0; j < UserData.propData.Count; j++)
                    {
                        UserPropData userPropData = UserData.propData[j];
                        if (propInfo.m_id == userPropData.prop_id)
                        {
                            userPropData.prop_icon = propInfo.m_icon;
                            userPropData.prop_name = propInfo.m_name;
                        }
                    }
                }

                if (UserData.medal > 0)
                {
                    var userPropData = new UserPropData();
                    userPropData.prop_icon = "icon_huizhang";
                    userPropData.prop_id   = (int)TLJCommon.Consts.Prop.Prop_huizhang;
                    userPropData.prop_name = "徽章";
                    userPropData.prop_num  = UserData.medal;
                    UserData.propData.Add(userPropData);
                }
            }
            else
            {
                ToastScript.createToast("用户背包数据错误");
                return;
            }
        }
        UpdateUI();
    }
Пример #14
0
        public async Task <string> RenderAsync(SerializableList <Role> model)
        {
            HtmlBuilder hb = new HtmlBuilder();

            bool header     = PropData.GetAdditionalAttributeValue("Header", true);
            bool exclude2FA = PropData.GetAdditionalAttributeValue("ExcludeUser2FA", false);
            bool?showFilter = PropData.GetAdditionalAttributeValue <bool?>("ShowFilter", null);

            if (model == null)
            {
                model = new SerializableList <Role>();
            }

            GridModel grid = new GridModel()
            {
                GridDef = GetGridModel(header, showFilter)
            };

            grid.GridDef.DirectDataAsync = (int skip, int take, List <DataProviderSortInfo> sorts, List <DataProviderFilterInfo> filters) => {
                List <RoleInfo> allRoles      = Resource.ResourceAccess.GetDefaultRoleList(Exclude2FA: exclude2FA);
                int             anonymousRole = Resource.ResourceAccess.GetAnonymousRoleId();
                List <Entry>    roles         = (from r in allRoles
                                                 orderby r.Name
                                                 where r.RoleId != anonymousRole
                                                 select new Entry {
                    RoleId = r.RoleId,
                    Name = r.Name,
                    Description = r.Description,
                    Used = model.Contains(new Role {
                        RoleId = r.RoleId
                    }, new RoleComparer())
                }).ToList <Entry>();

                DataSourceResult data = new DataSourceResult {
                    Data  = roles.ToList <object>(),
                    Total = roles.Count,
                };
                return(Task.FromResult(data));
            };

            hb.Append($@"
<div class='yt_yetawf_identity_rolesselector t_edit' id='{DivId}'>
    {await HtmlHelper.ForDisplayAsAsync(Container, PropertyName, FieldName, grid, nameof(grid.GridDef), grid.GridDef, "Grid", HtmlAttributes: HtmlAttributes)}
</div>");

            return(hb.ToString());
        }
    public void addTurntableBroadcast(string name, int reward_id)
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("TurntablePanelScript_hotfix", "addTurntableBroadcast"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.TurntablePanelScript_hotfix", "addTurntableBroadcast", null, name, reward_id);
            return;
        }

        try
        {
            TurntableBroadcastDataScript.getInstance().addData(name, reward_id);

            {
                m_ListViewScript.clear();
                for (int i = 0; i < TurntableBroadcastDataScript.getInstance().getTurntableBroadcastDataList().Count; i++)
                {
                    GameObject prefab = Resources.Load("Prefabs/UI/Item/Item_zhuanpan_guangbo") as GameObject;
                    GameObject obj    = MonoBehaviour.Instantiate(prefab);

                    {
                        TurntableBroadcastData temp = TurntableBroadcastDataScript.getInstance().getTurntableBroadcastDataList()[i];

                        TurntableData data = TurntableDataScript.getInstance().getDataById(temp.m_reward_id);
                        if (data != null)
                        {
                            string reward    = TurntableDataScript.getInstance().getDataById(temp.m_reward_id).m_reward;
                            int    prop_id   = CommonUtil.splitStr_Start(reward, ':');
                            int    prop_num  = CommonUtil.splitStr_End(reward, ':');
                            string prop_name = PropData.getInstance().getPropInfoById(prop_id).m_name;

                            string content = "恭喜" + temp.m_name + "获得" + prop_name + "*" + prop_num;
                            obj.transform.Find("Text").GetComponent <Text>().text = content;
                        }
                    }

                    m_ListViewScript.addItem(obj);
                }

                m_ListViewScript.addItemEnd();
            }
        }
        catch (Exception ex)
        {
            LogUtil.Log("addTurntableBroadcast异常----" + ex.Message);
        }
    }
Пример #16
0
        /// <summary>
        /// Called by the framework when the component needs to be rendered as HTML.
        /// </summary>
        /// <param name="model">The model being rendered by the component.</param>
        /// <returns>The component rendered as HTML.</returns>
        public async Task <string> RenderAsync(string model)
        {
            bool includeSiteCountry = PropData.GetAdditionalAttributeValue <bool>("SiteCountry", true);
            List <CountryISO3166.Country> countries = CountryISO3166.GetCountries(IncludeSiteCountry: includeSiteCountry);

            List <SelectionItem <string> > list = (from l in countries select new SelectionItem <string>()
            {
                Text = l.Name,
                Value = l.Id,
            }).ToList();

            list.Insert(0, new SelectionItem <string> {
                Text  = this.__ResStr("default", "(select)"),
                Value = "",
            });
            return(await DropDownListComponent.RenderDropDownListAsync(this, model, list, "yt_countryiso3166id"));
        }
Пример #17
0
        /// <summary>
        /// Called by the framework when the component needs to be rendered as HTML.
        /// </summary>
        /// <param name="model">The model being rendered by the component.</param>
        /// <returns>The component rendered as HTML.</returns>
        public async Task <string> RenderAsync(string model)
        {
            List <SelectionItem <string> > states = await CAProvince.ReadProvincesListAsync();

            bool useDefault = !PropData.GetAdditionalAttributeValue <bool>("NoDefault");

            if (useDefault)
            {
                states = (from s in states select s).ToList();//copy
                states.Insert(0, new SelectionItem <string> {
                    Text    = __ResStr("default", "(select)"),
                    Tooltip = __ResStr("defaultTT", "Please make a selection"),
                    Value   = "",
                });
            }
            return(await DropDownListComponent.RenderDropDownListAsync(this, model, states, "yt_caprovince"));
        }
Пример #18
0
        /// <summary>
        /// Called by the framework when the component needs to be rendered as HTML.
        /// </summary>
        /// <param name="model">The model being rendered by the component.</param>
        /// <returns>The component rendered as HTML.</returns>
        public async Task <string> RenderAsync(string model)
        {
            bool includeSiteCurrency = PropData.GetAdditionalAttributeValue <bool>("SiteCurrency", true);

            List <CurrencyISO4217.Currency> currencies = await CurrencyISO4217.GetCurrenciesAsync(IncludeSiteCurrency : includeSiteCurrency);

            List <SelectionItem <string> > list = (from l in currencies select new SelectionItem <string>()
            {
                Text = l.Name,
                Value = l.Id,
            }).ToList();

            list.Insert(0, new SelectionItem <string> {
                Text  = __ResStr("default", "(select)"),
                Value = "",
            });
            return(await DropDownListComponent.RenderDropDownListAsync(this, model, list, "yt_currencyiso4217"));
        }
Пример #19
0
        public void GetDirInfo(string path)
        {
            PropData data;

            if (Directory.Exists(path))
            {
                data = new PropData(new DirectoryInfo(path));
            }
            else
            {
                data = new PropData(new FileInfo(path));
            }
            using (var ms = new MemoryStream())
            {
                new BinaryFormatter().Serialize(ms, data);
                Connection.SendMessage(new MessageClass(Connection.ID, UserID, Commands.DirInfo, ID, ms.ToArray()));
            }
        }
Пример #20
0
        /// <summary>
        /// Called by the framework when the component needs to be rendered as HTML.
        /// </summary>
        /// <param name="model">The model being rendered by the component.</param>
        /// <returns>The component rendered as HTML.</returns>
        public Task <string> RenderAsync(Decimal?model)
        {
            HtmlBuilder hb = new HtmlBuilder();

            if (model != null && (Decimal)model > Decimal.MinValue && (Decimal)model < Decimal.MaxValue)
            {
                YTagBuilder tag = new YTagBuilder("div");
                tag.AddCssClass("yt_decimal");
                tag.AddCssClass("t_display");
                FieldSetup(tag, FieldType.Anonymous);
                string format = PropData.GetAdditionalAttributeValue("Format", "0.00");
                if (model != null)
                {
                    tag.SetInnerText(((decimal)model).ToString(format));
                }
                hb.Append(tag.ToString(YTagRenderMode.Normal));
            }
            return(Task.FromResult(hb.ToString()));
        }
Пример #21
0
 static private void SetPropDataFieldValuesFromFieldsString(PropData propData, string fieldsString)
 {
     // Divide the long string of ALL fields into an array, each slot just ONE field.
     string[] fieldStrings = fieldsString.Split(';');
     for (int i = 0; i < fieldStrings.Length; i++)
     {
         // Divide this one field and its value into a two-part array: first element is the NAME, second element is the VALUE.
         int colonIndex = fieldStrings[i].IndexOf(':');
         if (colonIndex < 0)               // This string isn't legit. Whoopsies!
         {
             Debug.LogError("Invalid line in room file: " + debug_roomDataLoadingRoomKey + ". \"" + fieldStrings[i] + "\"");
             continue;
         }
         string name  = fieldStrings[i].Substring(0, colonIndex);
         string value = fieldStrings[i].Substring(colonIndex + 1);
         // Set this specified field for this PropData!
         SetPropDataFieldValue(propData, name, value);
     }
 }
Пример #22
0
        /// <summary>
        /// Called by the framework when the component needs to be rendered as HTML.
        /// </summary>
        /// <param name="model">The model being rendered by the component.</param>
        /// <returns>The component rendered as HTML.</returns>
        public async Task <string> RenderAsync(string model)
        {
            bool useDefault   = !PropData.GetAdditionalAttributeValue <bool>("NoDefault");
            bool allLanguages = PropData.GetAdditionalAttributeValue <bool>("AllLanguages");

            List <SelectionItem <string> > list;

            if (allLanguages)
            {
                CultureInfo[] ci = CultureInfo.GetCultures(CultureTypes.AllCultures);
                list = (from c in ci orderby c.DisplayName select new SelectionItem <string>()
                {
                    Text = string.Format("{0} - {1}", c.DisplayName, c.Name),
                    Value = c.Name,
                }).ToList();
            }
            else
            {
                list = (from l in MultiString.Languages select new SelectionItem <string>()
                {
                    Text = l.ShortName,
                    Tooltip = l.Description,
                    Value = l.Id,
                }).ToList();
            }
            if (useDefault)
            {
                list.Insert(0, new SelectionItem <string> {
                    Text    = this.__ResStr("default", "(Site Default)"),
                    Tooltip = this.__ResStr("defaultTT", "Use the site defined default language"),
                    Value   = "",
                });
            }
            else
            {
                if (string.IsNullOrWhiteSpace(model))
                {
                    model = MultiString.ActiveLanguage;
                }
            }
            // display the languages in a drop down
            return(await DropDownListComponent.RenderDropDownListAsync(this, model, list, "yt_languageid"));
        }
Пример #23
0
        /// <summary>
        /// Called by the framework when the component needs to be rendered as HTML.
        /// </summary>
        /// <param name="model">The model being rendered by the component.</param>
        /// <returns>The component rendered as HTML.</returns>
        public Task <string> RenderAsync(Decimal?model)
        {
            HtmlBuilder hb = new HtmlBuilder();

            hb.Append($"<div id='{ControlId}' class='yt_currency t_edit y_inline'>");

            YTagBuilder tag = new YTagBuilder("input");

            FieldSetup(tag, Validation ? FieldType.Validated : FieldType.Normal);

            bool rdonly   = PropData.GetAdditionalAttributeValue <bool>("ReadOnly", false);
            bool disabled = PropData.GetAdditionalAttributeValue <bool>("Disabled", false);

            if (disabled)
            {
                tag.Attributes.Add("disabled", "disabled");
            }

            CurrencySetup setup = new CurrencySetup {
                Min      = 0,
                Max      = 999999999.99,
                ReadOnly = rdonly,
            };
            // handle min/max
            RangeAttribute rangeAttr = PropData.TryGetAttribute <RangeAttribute>();

            if (rangeAttr != null)
            {
                setup.Min = (double)rangeAttr.Minimum;
                setup.Max = (double)rangeAttr.Maximum;
            }
            if (model != null)
            {
                tag.MergeAttribute("value", Formatting.FormatAmount((decimal)model));
            }

            hb.Append(tag.ToString(YTagRenderMode.StartTag));

            hb.Append($"</div>");
            Manager.ScriptManager.AddLast($@"new YetaWF_ComponentsHTML.CurrencyEditComponent('{ControlId}', {Utility.JsonSerialize(setup)});");

            return(Task.FromResult(hb.ToString()));
        }
Пример #24
0
    protected virtual void InitBtn()
    {
        UIHangerPropBtn hanger = gameObject.GetComponent <UIHangerPropBtn>();

        if (hanger == null)
        {
            hanger = gameObject.AddComponent <UIHangerPropBtn>();
            hanger.Init(c_btnPrefabPath, gameObject, 100);
            hanger.RegisterOnClick(OnPropBeginUsing);
        }

        if (PropId == 204)
        {
            Debug.Log("");
        }

        // 检查是否有依赖的道具,如果有并且依赖的道具有图标,则显示为该图标
        string iconPath = "Sprite/Prop/use_normal";
        int    prevId   = PropData.GetData <int>("prev_prop");

        if (prevId != 0)
        {
            PropData theData = new PropData(prevId);
            string   thePath = theData.GetData <string>("icon");
            if (thePath != default(string))
            {
                iconPath = thePath;
            }
        }

        // 特殊处理一下,如果是最后的心心,使用心的图标
        if (PropId == 209)
        {
            iconPath = "Sprite/Prop/use_love";
        }
        hanger.SetIcon(iconPath);

        m_uiBtn = hanger.HangObject;
        if (PropId != 209)
        {
            m_uiBtn.SetActive(false);                // 默认隐藏
        }
    }
Пример #25
0
        public async Task <string> RenderAsync(SerializableList <YetaWF.Core.Identity.Role> model)
        {
            HtmlBuilder hb = new HtmlBuilder();

            if (model == null)
            {
                model = new SerializableList <YetaWF.Core.Identity.Role>();
            }

            bool header = PropData.GetAdditionalAttributeValue("Header", true);

            GridModel grid = new GridModel()
            {
                GridDef = GetGridModel(header)
            };

            grid.GridDef.DirectDataAsync = (int skip, int take, List <DataProviderSortInfo> sorts, List <DataProviderFilterInfo> filters) => {
                List <RoleInfo> allRoles      = Resource.ResourceAccess.GetDefaultRoleList();
                int             superuserRole = Resource.ResourceAccess.GetSuperuserRoleId();
                int             userRole      = Resource.ResourceAccess.GetUserRoleId();
                List <Entry>    roles         = (from r in allRoles orderby r.Name
                                                 select new Entry {
                    RoleId = r.RoleId,
                    Name = r.Name,
                    Description = r.Description,
                    InRole = userRole == r.RoleId || (model != null && model.Contains(new Role {
                        RoleId = r.RoleId
                    }, new RoleComparer())),
                }).ToList <Entry>();
                DataSourceResult data = new DataSourceResult {
                    Data  = roles.ToList <object>(),
                    Total = roles.Count,
                };
                return(Task.FromResult(data));
            };

            hb.Append($@"
<div class='yt_yetawf_identity_userroles t_display'>
    {await HtmlHelper.ForDisplayAsAsync(Container, PropertyName, FieldName, grid, nameof(grid.GridDef), grid.GridDef, "Grid", HtmlAttributes: HtmlAttributes)}
</div>");

            return(hb.ToString());
        }
Пример #26
0
 private void AddPropFromData(PropData data)
 {
     if (data is GateData)
     {
         Gate prop = Instantiate(resourcesHandler.gate).GetComponent <Gate>();
         prop.Initialize(this, data as GateData);
         gates.Add(prop);
     }
     else if (data is GateButtonData)
     {
         GateButton prop = Instantiate(resourcesHandler.gateButton).GetComponent <GateButton>();
         prop.Initialize(this, data as GateButtonData);
         gateButtons.Add(prop);
     }
     else if (data is GemData)
     {
         Gem prop = Instantiate(resourcesHandler.gem).GetComponent <Gem>();
         prop.Initialize(this, data as GemData);
         gems.Add(prop);
     }
     else if (data is ToggleGroundData)
     {
         ToggleGround prop = Instantiate(resourcesHandler.toggleGround).GetComponent <ToggleGround>();
         prop.Initialize(this, data as ToggleGroundData);
         toggleGrounds.Add(prop);
     }
     else if (data is GroundData)
     {
         Ground prop = Instantiate(resourcesHandler.ground).GetComponent <Ground>();
         prop.Initialize(this, data as GroundData);
         grounds.Add(prop);
     }
     else if (data is PlayerData)
     {
         Player prop = Instantiate(resourcesHandler.player).GetComponent <Player>();
         prop.Initialize(this, data as PlayerData);
         player = prop;
     }
     else
     {
         Debug.LogError("Unrecognized PropData type: " + data);
     }
 }
Пример #27
0
        public async Task <string> RenderAsync(string model)
        {
            // get all available skins
            SkinAccess skinAccess = new SkinAccess();
            List <SelectionItem <string> > list = (from theme in skinAccess.GetSyntaxHighlighterThemeList() select new SelectionItem <string>()
            {
                Text = theme.Name,
                Tooltip = theme.Description,
                Value = theme.Name,
            }).ToList();

            bool useDefault = PropData.GetAdditionalAttributeValue <bool>("NoDefault", false);

            if (useDefault)
            {
                list.Insert(0, new SelectionItem <string> {
                    Text    = this.__ResStr("default", "(Site Default)"),
                    Tooltip = this.__ResStr("defaultTT", "Use the site defined default theme"),
                    Value   = "",
                });
            }
            else if (model == null)
            {
                model = SkinAccess.GetSyntaxHighlighterDefaultSkin();
            }


            if (useDefault)
            {
                list.Insert(0, new SelectionItem <string> {
                    Text    = this.__ResStr("default", "(Site Default)"),
                    Tooltip = this.__ResStr("defaultTT", "Use the site defined default theme"),
                    Value   = "",
                });
            }
            else if (model == null)
            {
                model = SkinAccess.GetSyntaxHighlighterDefaultSkin();
            }

            return(await DropDownListComponent.RenderDropDownListAsync(this, model, list, "yt_yetawf_syntaxhighlighter_syntaxhighlighter"));
        }
Пример #28
0
		/// <summary>
		/// Creates new prop, based on prop data.
		/// </summary>
		/// <param name="propData"></param>
		/// <param name="regionId"></param>
		/// <param name="regionName"></param>
		/// <param name="areaName"></param>
		public Prop(PropData propData, int regionId, string regionName, string areaName)
			: this(propData.EntityId, propData.Id, regionId, (int)propData.X, (int)propData.Y, propData.Direction, propData.Scale, 0, "", "", "")
		{
			// Set full name
			this.GlobalName = string.Format("{0}/{1}/{2}", regionName, areaName, propData.Name);

			// Save parameters for use by dungeons
			this.Parameters = propData.Parameters.ToList();

			// Add drop behaviour if drop type exists
			var dropType = propData.GetDropType();
			if (dropType != -1)
				this.Behavior = Prop.GetDropBehavior(dropType);

			// Replace default shapes with the ones loaded from region.
			// (Is this really necessary?)
			this.State = propData.State;
			this.Shapes.Clear();
			this.Shapes.AddRange(propData.Shapes.Select(a => a.GetPoints(0, 0, 0)));
		}
Пример #29
0
        public void SetProps(PropData data)
        {
            if (data.IsFolder)
            {
                FolderIcon.Opacity = 1;
            }
            else
            {
                FileIcon.Opacity = 1;
            }

            NameLabel.Content       = data.Name;
            FullNameLabel.Content   = data.FullName;
            SizeLabel.Content       = ToNormal(data.Size) + " (" + ToLong(data.Size) + " bytes)";
            FileCountLabel.Content  = data.FilesCount + " files";
            CreatedLabel.Content    = data.Creation.ToString();
            ChangingLabel.Content   = data.Changing.ToString();
            OpenedLabel.Content     = data.Opened.ToString();
            AttributesLabel.Content = data.Attributes;
        }
    public void setGoodsId(int goods_id)
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("MedalDuiHuanQueRenPanelScript_hotfix", "setGoodsId"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.MedalDuiHuanQueRenPanelScript_hotfix", "setGoodsId", null, goods_id);
            return;
        }

        m_medalDuiHuanRewardData = MedalDuiHuanRewardData.getInstance().getMedalDuiHuanRewardDataContentById(goods_id);

        if (m_medalDuiHuanRewardData != null)
        {
            m_text_goods_name.text = m_medalDuiHuanRewardData.name;

            m_text_goods_num.text = m_goods_num.ToString();

            List <string> list_str = new List <string>();
            CommonUtil.splitStr(m_medalDuiHuanRewardData.reward_prop, list_str, ':');
            int prop_id = int.Parse(list_str[0]);

            // 道具图标
            {
                CommonUtil.setImageSprite(m_text_goods_icon, GameUtil.getPropIconPath(prop_id));
            }

            // 道具描述
            {
                if ((prop_id != 1) && (prop_id != 2))
                {
                    PropInfo propInfo = PropData.getInstance().getPropInfoById(prop_id);
                    if (propInfo != null)
                    {
                        m_text_goods_desc.text = propInfo.m_desc;
                    }
                }
            }

            refreshPrice();
        }
    }
Пример #31
0
Файл: Prop.cs Проект: Vinna/aura
		/// <summary>
		/// Creates new prop, based on prop data.
		/// </summary>
		/// <param name="propData"></param>
		/// <param name="regionId"></param>
		/// <param name="regionName"></param>
		/// <param name="areaName"></param>
		public Prop(PropData propData, int regionId, string regionName, string areaName)
			: this(propData.EntityId, propData.Id, regionId, (int)propData.X, (int)propData.Y, propData.Direction, propData.Scale, 0, "", "", "")
		{
			// Set full name
			this.GlobalName = string.Format("{0}/{1}/{2}", regionName, areaName, propData.Name);

			// Save parameters for use by dungeons
			this.Parameters = propData.Parameters.ToList();

			// Add drop behaviour if drop type exists
			var dropType = propData.GetDropType();
			if (dropType != -1)
				this.Behavior = Prop.GetDropBehavior(dropType);

			// Replace default shapes with the ones loaded from region.
			this.Shapes.Clear();
			this.Shapes.AddRange(propData.Shapes.Select(a => a.GetPoints(0, 0, 0)));
		}
Пример #32
0
 protected override void Parse(EndianBinaryReader r)
 {
     EID = ReadVarInt(r);
     int count = r.ReadInt32();
     //Console.Write("DEBx2C: " + EID + " ");
     for(int n = 0; n < count; n++)
     {
         var p = new Property();
         p.Key = ReadString8(r);
         p.Val = r.ReadDouble();
         int sub = ReadVarInt(r);
         p.List = new List<PropData>();
         for (int s = 0; s < sub; s++)
         {
             var sd = new PropData();
             sd.UUIDpart1 = r.ReadInt64();
             sd.UUIDpart2 = r.ReadInt64();
             sd.Amount = r.ReadDouble();
             sd.Operation = r.ReadByte();
             p.List.Add(sd);
         }
         Properties.Add(p);
     }
     //Debug.WriteLine(this);
 }