135 lines
4.0 KiB
C#
135 lines
4.0 KiB
C#
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
using GCGame.Table;
|
|||
|
|
|||
|
public class CreateRoomPanel : MonoBehaviour {
|
|||
|
|
|||
|
public static CreateRoomPanel Instance;
|
|||
|
private void Awake()
|
|||
|
{
|
|||
|
Instance = this;
|
|||
|
}
|
|||
|
|
|||
|
private void OnDestroy()
|
|||
|
{
|
|||
|
Instance = null;
|
|||
|
}
|
|||
|
|
|||
|
public Text _SegmentInput;
|
|||
|
public InputField _PassWordInput;
|
|||
|
|
|||
|
public UIContainerBase _SegmentSelecItemContainer;
|
|||
|
public UIContainerBase _PassWordSelectItemContainer;
|
|||
|
|
|||
|
public int _CurSelectSegmentType = 0; //默认不限制
|
|||
|
public void OnSegmentSettingBtn()
|
|||
|
{
|
|||
|
_SegmentSelecItemContainer.gameObject.SetActive(true);
|
|||
|
_PassWordSelectItemContainer.gameObject.SetActive(false);
|
|||
|
|
|||
|
List<PvpSelectItemStruct> selectitemList = new List<PvpSelectItemStruct>();
|
|||
|
for(int index = 0; index <= GameManager.gameManager.PlayerDataPool.pvpIfo.MaxSegmentGrade; index++)
|
|||
|
{
|
|||
|
selectitemList.Add(new PvpSelectItemStruct(0, index, OnPvpSegmentSelectItemClick));
|
|||
|
}
|
|||
|
|
|||
|
_SegmentSelecItemContainer.InitContentItem(selectitemList);
|
|||
|
_SegmentSelecItemContainer.ForeachActiveItem<PvpSelectItem>((item) => {
|
|||
|
item.ShowMarkIcon(item.param == _CurSelectSegmentType);
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
public void OnPvpSegmentSelectItemClick(int param)
|
|||
|
{
|
|||
|
_CurSelectSegmentType = param;
|
|||
|
if (param == 0)
|
|||
|
{
|
|||
|
_SegmentInput.text = StrDictionary.GetClientDictionaryString("#{82039}");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_SegmentInput.text = GameManager.gameManager.PlayerDataPool.pvpIfo.GetSegmentGradeDesc(param);
|
|||
|
}
|
|||
|
|
|||
|
OnBackClick();
|
|||
|
}
|
|||
|
|
|||
|
//0.不设置密码 1.设置密码
|
|||
|
private int _PassWordType = 0;
|
|||
|
public void OnPvpPassWordSelectitemClick(int param)
|
|||
|
{
|
|||
|
_PassWordType = param;
|
|||
|
if (param == 0)
|
|||
|
{
|
|||
|
_PassWordInput.text = "";
|
|||
|
// _PassWordInput.textComponent.text = StrDictionary.GetClientDictionaryString("#{82036}");
|
|||
|
//_PassWordInput.placeholder.gameObject.GetComponent<Text>().text = StrDictionary.GetClientDictionaryString("#{82036}");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_PassWordInput.placeholder.gameObject.GetComponent<Text>().text = "";
|
|||
|
_PassWordInput.textComponent.text = "";
|
|||
|
}
|
|||
|
OnBackClick();
|
|||
|
}
|
|||
|
|
|||
|
public void OnPassWordSettingBtn()
|
|||
|
{
|
|||
|
_SegmentSelecItemContainer.gameObject.SetActive(false);
|
|||
|
_PassWordSelectItemContainer.gameObject.SetActive(true);
|
|||
|
|
|||
|
List<PvpSelectItemStruct> passWordList = new List<PvpSelectItemStruct>();
|
|||
|
passWordList.Add(new PvpSelectItemStruct(1, 0, OnPvpPassWordSelectitemClick));
|
|||
|
passWordList.Add(new PvpSelectItemStruct(1, 1, OnPvpPassWordSelectitemClick));
|
|||
|
_PassWordSelectItemContainer.InitContentItem(passWordList);
|
|||
|
_PassWordSelectItemContainer.ForeachActiveItem<PvpSelectItem>((item) => {
|
|||
|
item.ShowMarkIcon(item.param == _PassWordType);
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
public void OnCraeteBtn()
|
|||
|
{
|
|||
|
ReqHonorBattlefieldMatchCreateRoom req = new ReqHonorBattlefieldMatchCreateRoom();
|
|||
|
if (_CurSelectSegmentType < 1)
|
|||
|
{
|
|||
|
req.Segment = -1;
|
|||
|
}else
|
|||
|
{
|
|||
|
req.Segment = _CurSelectSegmentType;
|
|||
|
}
|
|||
|
|
|||
|
req.Password = _PassWordType == 0 ? "" : _PassWordInput.text;
|
|||
|
req.SendMsg();
|
|||
|
|
|||
|
OnCloseBtn();
|
|||
|
}
|
|||
|
|
|||
|
public void OnPassWordInputValChange()
|
|||
|
{
|
|||
|
if (_PassWordInput.text.Equals(""))
|
|||
|
{
|
|||
|
//_PassWordInput.textComponent.text = StrDictionary.GetClientDictionaryString("#{82036}");
|
|||
|
_PassWordType = 0;
|
|||
|
}else
|
|||
|
{
|
|||
|
if (_PassWordType == 0)
|
|||
|
_PassWordType = 1;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void OnBackClick()
|
|||
|
{
|
|||
|
_SegmentSelecItemContainer.gameObject.SetActive(false);
|
|||
|
_PassWordSelectItemContainer.gameObject.SetActive(false);
|
|||
|
}
|
|||
|
|
|||
|
public void OnCloseBtn()
|
|||
|
{
|
|||
|
this.gameObject.SetActive(false);
|
|||
|
}
|
|||
|
|
|||
|
}
|