示例#1
0
        private void UpdateOtherOptions(IList <string> option, IDictionary <string, ItemData> cArgs, bool isSelected)
        {
            if (option == null)
            {
                return;
            }
            var count = option.Count;

            for (var i = 0; i < count; i++)
            {
                var dpId = option[i];
                if (!cArgs.ContainsKey(dpId))
                {
                    continue;
                }
                var otherData = cArgs[dpId];
                var dpView    = otherData.View;
                if (dpView == null)
                {
                    continue;
                }
                var nguiCb = (NguiCheckBox)dpView;
                nguiCb.Toggle.value = isSelected;
                CreateRoomRuleInfo.SaveItemState(CurRuleInfo.CurTabId, otherData.Id, otherData.Group, CurRuleInfo.GameKey, isSelected);
            }
        }
示例#2
0
        private void UpdataAllState(ItemData data, IDictionary <string, ItemData> cArgs)
        {
            if (data == null)
            {
                return;
            }
            var allView = (NguiCheckBox)data.View;

            if (allView == null)
            {
                return;
            }
            var toggle = allView.Toggle;

            toggle.value = false;
            var option = data.Dp;

            if (option == null)
            {
                return;
            }
            var count = option.Length;

            for (var i = 0; i < count; i++)
            {
                var dpId = option[i];
                if (!cArgs.ContainsKey(dpId))
                {
                    continue;
                }
                var otherData = cArgs[dpId];
                var dpView    = otherData.View;
                if (dpView == null)
                {
                    continue;
                }
                if (((NguiCheckBox)dpView).Toggle.value)
                {
                    continue;
                }
                CreateRoomRuleInfo.SaveItemState(CurRuleInfo.CurTabId, data.Id, data.Group, CurRuleInfo.GameKey, false);
                return;
            }
            toggle.value = true;
            CreateRoomRuleInfo.SaveItemState(CurRuleInfo.CurTabId, data.Id, data.Group, CurRuleInfo.GameKey, true);
        }
示例#3
0
        /// <summary>
        /// 选项更改
        /// </summary>
        /// <param name="view"></param>
        public void OnOptionClick(NguiCheckBox view)
        {
            if (CurRuleInfo == null)
            {
                return;
            }
            var id    = view.Id;
            var cArgs = CurRuleInfo.CreateArgs;

            if (!cArgs.ContainsKey(id))
            {
                return;
            }
            var cData = cArgs[id];

            if (cData == null)
            {
                return;
            }
            var type       = cData.Type;
            var curToggle  = view.Toggle;
            var isSelected = curToggle.value;
            var group      = cData.Group;
            var curBtnId   = cData.Id;

            if (isSelected)
            {
                switch (type)
                {
                case RuleItemType.tab:
                    if (CurRuleInfo.CurTabId == curBtnId)
                    {
                        return;
                    }
                    CurRuleInfo.CurTabId = cData.Id;
                    CurRuleInfo.SetButtonId(group, cData.Id);
                    CreateRoomRuleInfo.SaveItemState(null, cData.Id, group, CurRuleInfo.GameKey, true);
                    if (SelectTabToggle != null)
                    {
                        OnChangeTabWithToggle(SelectTabToggle);
                    }
                    return;

                case RuleItemType.button:
                    curBtnId = CurRuleInfo.CurrentButtonId(group);
                    if (curBtnId == cData.Id)
                    {
                        return;
                    }
                    CurRuleInfo.SetButtonId(group, cData.Id);
                    CreateRoomRuleInfo.SaveItemState(CurRuleInfo.CurTabId, cData.Id, group, CurRuleInfo.GameKey, true);
                    if (SelectTabToggle != null)
                    {
                        OnChangeTabWithToggle(SelectTabToggle);
                    }
                    return;

                default:
                    CreateRoomRuleInfo.SaveItemState(CurRuleInfo.CurTabId, cData.Id, group, CurRuleInfo.GameKey, true);
                    ExecuteWithClickType(cData, cArgs);
                    if (!IsNotClick(cData.Key == AllField, curToggle.gameObject))
                    {
                        UpdateOtherOptions(cData.Dp, cArgs, true);
                        UpdateOtherOptions(cData.Ep, cArgs, false);
                    }
                    break;
                }
            }
            else
            {
                CreateRoomRuleInfo.SaveItemState(CurRuleInfo.CurTabId, cData.Id, group, CurRuleInfo.GameKey, false);
                if (!IsNotClick(cData.Key == AllField, curToggle.gameObject))
                {
                    UpdateOtherOptions(cData.Rp, cArgs, false);
                }
            }
            if (cData.Key == AllField)
            {
                return;
            }
            if (!IsNotClick(true, view.gameObject))
            {
                var allCreateData = GetAllRp(cArgs);
                UpdataAllState(allCreateData, cArgs);
            }
        }