예제 #1
0
    public void BtnToMap(GameObject obj)
    {
        PVPBattleItem item = obj.GetComponent <PVPBattleItem>();

        PanelStatic.StaticBtnGameManagerBack.UICL.SendMessage("SelectChannel", item.ItemID, SendMessageOptions.DontRequireReceiver);
        //		item.ItemID		//item.ItemID	就是地图实例ID
//		ServerRequest.requestAddToMap(MapId,point);
    }
예제 #2
0
    public void SelectClick(GameObject obj)
    {
        foreach (PVPBattleItem CI in childItems)
        {
            CI.gameObject.SetActive(false);
        }

        PVPBattleItem item = obj.GetComponent <PVPBattleItem>();

        if (channelDic.ContainsKey(item.ItemID))
        {
            List <string> channels = channelDic[item.ItemID];

            for (int i = 0; i < channels.Count; i++)
            {
                string[] channelInfo = channels[i].Split(',');
                if (i >= gridChanel1.transform.childCount)
                {
                    GameObject objBtn = (GameObject)Instantiate(btnChannelMap);
                    objBtn.transform.parent     = gridChanel1.transform;
                    objBtn.transform.localScale = new Vector3(1, 1, 1);
                    objBtn.SetActive(false);
                    UIButtonMessage btnMessage = objBtn.GetComponent <UIButtonMessage>();
                    btnMessage.target       = this.gameObject;
                    btnMessage.functionName = "BtnToMap";
                    PVPBattleItem tempBtn = objBtn.GetComponent <PVPBattleItem>();
                    tempBtn.SetBattleName(string.Format("{0}{1}{2}", yt.Rows[0]["MapName"].YuanColumnText, (i + 1).ToString(), StaticLoc.Loc.Get("info1153")));
//					Debug.Log("ran=============================="+channelInfo[1].ToString());
                    if (int.Parse(channelInfo[1]) == 1)
                    {
                        tempBtn.SetBattleLblbusy(StaticLoc.Loc.Get("info1160"));
                    }

                    if (int.Parse(channelInfo[1]) == 0)
                    {
                        tempBtn.SetBattleLblbusy(StaticLoc.Loc.Get("info1161"));
                    }

                    tempBtn.ItemID = int.Parse(channelInfo[0]);
                    childItems.Add(tempBtn);
                }

                childItems[i].ItemID = int.Parse(channelInfo[0]);
                childItems[i].gameObject.SetActive(true);
                if (PlayerUtil.mapInstanceID == childItems[i].ItemID)
                {
                    LblMyChannel.text = string.Format("{0}{1}{2}{3}", StaticLoc.Loc.Get("info1162"), yt.Rows[0]["MapName"].YuanColumnText, (i + 1).ToString(), StaticLoc.Loc.Get("info1153"));
                }

                if (LblMyChannelOther)
                {
                    LblMyChannelOther.text = LblMyChannel.text;
                }
            }
            gridChanel1.repositionNow = true;
        }
    }
예제 #3
0
    public void ShowSelectChannel(Dictionary <int, bool> selectchannel)
    {
        index = 0;
        int           count           = 0;
        List <string> channelInfoList = new List <string>();

        foreach (KeyValuePair <int, bool> kvp in selectchannel)
        {
            int    val     = kvp.Value ? 1 : 0;
            string tempStr = string.Format("{0},{1}", kvp.Key, val);
            channelInfoList.Add(tempStr);
            count++;

            if (count >= size)
            {
                channelDic.Add(index, channelInfoList);
                index++;
                count           = 0;
                channelInfoList = new List <string>();
            }
        }

        if (selectchannel.Count < size)
        {
            channelDic.Add(0, channelInfoList);
        }

        if (channelDic.Count >= 0)
        {
            foreach (int key in channelDic.Keys)
            {
                GameObject objBtn = (GameObject)Instantiate(btnChannel);
                objBtn.transform.parent     = gridChanel.transform;
                objBtn.transform.localScale = new Vector3(1, 1, 1);
                UIButtonMessage btnMessage = objBtn.GetComponent <UIButtonMessage>();
                btnMessage.target       = this.gameObject;
                btnMessage.functionName = "SelectClick";
                PVPBattleItem tempBtn = objBtn.GetComponent <PVPBattleItem>();
                tempBtn.SetBattleName(string.Format("{0}{1}{2}", yt.Rows[0]["MapName"].YuanColumnText, (key + 1).ToString(), StaticLoc.Loc.Get("info1154")));
                tempBtn.ItemID = key;

                Transform firstTran = this.gridChanel.GetChild(0);
                firstTran.GetComponent <UIToggle>().value = true;
                SelectClick(firstTran.gameObject);
            }
        }
        gridChanel.repositionNow = true;
    }
예제 #4
0
    public void BattleItemClick(GameObject sender)
    {
        if (isSingleMatching || isTeamMatching)
        {
            for (int i = 0; i < childItems.Count; i++)
            {
                if (selectedID == childItems[i].ItemID)
                {
                    childItems[i].transform.GetComponent <UIToggle>().value = true;
                }
            }

            PanelStatic.StaticWarnings.warningAllTime.Show("", StaticLoc.Loc.Get("battle009"));

            return;
        }

        PVPBattleItem item = sender.GetComponent <PVPBattleItem>();

        selectedID = item.ItemID;
        if (battlefieldInfoDic.ContainsKey(selectedID))
        {
            yuan.YuanMemoryDB.YuanRow yrBattle = null;
            if (battlefieldInfoDic.TryGetValue(selectedID, out yrBattle))
            {
                SetBattleInfo(yrBattle["description"].YuanColumnText);
                SetConditionInfo(string.Format("{0}-{1}{2}", yrBattle["minLevel"].YuanColumnText, yrBattle["maxLevel"].YuanColumnText, StaticLoc.Loc.Get("battle005")));
            }
        }
        else
        {
            Debug.LogError("PanelPVPBattlefield::BattleItemClick---------------selectedID is not contained in battlefieldInfoDic!");
        }

        //OnDisable();
        //OnEnable();
    }