コード例 #1
0
    static int IntToEnum(IntPtr L)
    {
        int arg0 = (int)LuaDLL.lua_tonumber(L, 1);

        UIInput.Validation o = (UIInput.Validation)arg0;
        ToLua.Push(L, o);
        return(1);
    }
コード例 #2
0
    static int set_validation(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UIInput            obj  = (UIInput)o;
            UIInput.Validation arg0 = (UIInput.Validation)ToLua.CheckObject(L, 2, typeof(UIInput.Validation));
            obj.validation = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index validation on a nil value" : e.Message));
        }
    }
コード例 #3
0
    static int get_validation(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UIInput            obj = (UIInput)o;
            UIInput.Validation ret = obj.validation;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index validation on a nil value" : e.Message));
        }
    }
コード例 #4
0
    private static int set_validation(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            UIInput            uIInput    = (UIInput)obj;
            UIInput.Validation validation = (UIInput.Validation)((int)ToLua.CheckObject(L, 2, typeof(UIInput.Validation)));
            uIInput.validation = validation;
            result             = 0;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index validation on a nil value");
        }
        return(result);
    }
コード例 #5
0
    private static int get_validation(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            UIInput            uIInput    = (UIInput)obj;
            UIInput.Validation validation = uIInput.validation;
            ToLua.Push(L, validation);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index validation on a nil value");
        }
        return(result);
    }
コード例 #6
0
ファイル: ItemData.cs プロジェクト: da1fanshu/yizhe
        public ItemData(int index, object item, CreateRoomRuleInfo parent)
        {
            Parent = parent;
            Index  = index;
            var itemDict = item as Dictionary <string, object>;

            if (itemDict == null)
            {
                Id      = "";
                Name    = "";
                Type    = RuleItemType.none;
                Key     = "";
                State   = false;
                Value   = "";
                Width   = 0;
                Height  = 0;
                UseItem = "";
                UseNum  = 0;
                Group   = 0;
                Dp      = null;
                Ep      = null;
                Rp      = null;
                Tip     = "";
                return;
            }
            Id           = itemDict.ContainsKey("id") ? itemDict["id"].ToString() : "";
            Name         = itemDict.ContainsKey("name") ? itemDict["name"].ToString() : "";
            Key          = itemDict.ContainsKey("key") ? itemDict["key"].ToString() : "";
            DefaultState = State = itemDict.ContainsKey("state") && itemDict["state"].ToString().ToLower() == "true";
            NeedConvert  = itemDict.ContainsKey("needConvert") && itemDict["needConvert"].ToString().ToLower() == "true";
            Options      = itemDict.ContainsKey("options") ? itemDict["options"].ToString() : "";
            Value        = itemDict.ContainsKey("value") ? itemDict["value"].ToString() : "";
            Width        = itemDict.ContainsKey("width") ? int.Parse(itemDict["width"].ToString()) : 0;
            Height       = itemDict.ContainsKey("height") ? int.Parse(itemDict["height"].ToString()) : 0;
            UseItem      = itemDict.ContainsKey("useitem") ? itemDict["useitem"].ToString() : "";

            if (itemDict.ContainsKey("shownum"))
            {
                UseNum = float.Parse(itemDict["shownum"].ToString());
            }
            else
            {
                UseNum = itemDict.ContainsKey("usenum") ? int.Parse(itemDict["usenum"].ToString()) : 0;
            }
            Group         = itemDict.ContainsKey("group") ? int.Parse(itemDict["group"].ToString()) : 0;
            Size          = itemDict.ContainsKey("fontSize") ? int.Parse(itemDict["fontSize"].ToString()) : 0;
            Dp            = itemDict.ContainsKey("dp") ? itemDict["dp"].ToString().Split(',') : new string[0];
            Ep            = itemDict.ContainsKey("ep") ? itemDict["ep"].ToString().Split(',') : new string[0];
            Rp            = itemDict.ContainsKey("rp") ? itemDict["rp"].ToString().Split(',') : new string[0];
            Range         = itemDict.ContainsKey("range") ? itemDict["range"].ToString().Split(',') : null;
            ShowType      = itemDict.ContainsKey("showtype") ? int.Parse(itemDict["showtype"].ToString()) : 0;
            Type          = itemDict.ContainsKey("type") ? (RuleItemType)Enum.Parse(typeof(RuleItemType), itemDict["type"].ToString()) : RuleItemType.none;
            Validation    = itemDict.ContainsKey("validation") ? (UIInput.Validation)Enum.Parse(typeof(UIInput.Validation), itemDict["validation"].ToString()) : UIInput.Validation.None;
            SliderType    = itemDict.ContainsKey("sliderType") ? (YxECrSliderType)Enum.Parse(typeof(YxECrSliderType), itemDict["sliderType"].ToString()) : YxECrSliderType.Integer;
            Tip           = itemDict.ContainsKey("tip") ? itemDict["tip"].ToString() : "";
            FloatValidity = itemDict.ContainsKey("floatValidity") ? int.Parse(itemDict["floatValidity"].ToString()) : 2;

            if (itemDict.ContainsKey("hide"))
            {
                var hideIds = itemDict["hide"].ToString().Split(',');
                parent.AddHideIds(Id, hideIds);
            }
            switch (Type)
            {
            case RuleItemType.none:
            case RuleItemType.label:
                break;

            case RuleItemType.tab:
//                    parent.CreateArgs[Id] = this;//保存数据id
                State = CreateRoomRuleInfo.GetItemState(null, Id, Group, parent.GameKey, State);
                if (State)
                {
                    parent.CurTabId = Id;
                    parent.SetButtonId(Group, Id);
                }
                break;

            case RuleItemType.button:
//                    parent.CreateArgs[Id] = this;
                State = CreateRoomRuleInfo.GetItemState(parent.CurTabId, Id, Group, parent.GameKey, State);
                if (State)
                {
                    parent.SetButtonId(Group, Id);
                }
                break;

            case RuleItemType.input:
            case RuleItemType.pop:
            case RuleItemType.slider:
//                    parent.CreateArgs[Id] = this;
                Value = CreateRoomRuleInfo.GetItemValue(parent.CurTabId, Id, parent.GameKey, Value);
                break;

            default:
//                    parent.CreateArgs[Id] = this;
                State = CreateRoomRuleInfo.GetItemState(parent.CurTabId, Id, Group, parent.GameKey, State);
                break;
            }
            //                Debug.Log(string.Format("--------->:{0},{1},{2},{3}", Id,Group,Name,State));
            if (itemDict.ContainsKey("clicktype"))
            {
                var info  = itemDict["clicktype"].ToString();
                var infos = info.Split('|');
                if (infos.Length > 0)
                {
                    ClickType = new ClickTypeData
                    {
                        Type = (ECLickType)Enum.Parse(typeof(ECLickType), infos[0]),
                        Parm = infos.Length > 1 ? infos[1].Split(',') : new string[0]
                    };
                }
            }
        }