Ejemplo n.º 1
0
    //匹配记录的机关状态 门是开的还是关的 BOSS有没有杀掉
    public void GetPiPei()
    {
        string TempCurrentGKDate = GlobalDateControl.GetCurrentGKDate().Split(':')[1];

        print("*****************************************************************开始进行 当前关卡的数据匹配 TempCurrentGKDate:  " + TempCurrentGKDate);
        if (TempCurrentGKDate == "")
        {
            return;
        }
        //开始匹配关卡数据
        string[] strArr = TempCurrentGKDate.Split(',');
        //if (Globals.isDebug) print("匹配!!TempCurrentGKDate:   "+ TempCurrentGKDate);
        print(" 匹配关卡记录数据------------------------ >  " + strArr + "  length   " + strArr.Length);
        for (var i = 0; i < strArr.Length; i++)
        {
            print("*******************************************************************************************" + strArr[i]);
            if (strArr[i] == "")
            {
                continue;
            }
            string s = strArr[i].Split('-')[0];
            s = GlobalTools.GetNewStrQuDiaoClone(s);
            //s = GlobalTools.GetNewStrQuDiaoKuohao(s);
            string zt = "0";
            if (strArr[i].Split('-').Length > 1)
            {
                zt = strArr[i].Split('-')[1].Split('@')[0];
            }

            string sName = s.Split('_')[0];

            //print("字母头 sName:    " + sName+" zt  "+zt);


            //找名字 好像部分大小写
            if (sName == "Men")
            {
                if (zt == "0")
                {
                    //print("ssss  "+s);
                    GlobalTools.FindObjByName(s).GetComponent <Door>().Chushi();
                }
                else if (zt == "1")
                {
                    //print("s   " + s);
                    GlobalTools.FindObjByName(s).GetComponent <Door>().HasOpen();
                }
            }
            else if (sName == "BOSS" || sName == "B")
            {
                print("匹配到 boss名字 :   " + s);
                GameObject boss = GlobalTools.FindObjByName(s);
                if (boss != null)
                {
                    print(">>>进来没!!!");
                    boss.SetActive(false);
                    DestroyImmediate(boss, true);
                }
            }
            else if (sName == "WP")
            {
                //GlobalTools.FindObjByName(s).SetActive(false);
                if (zt == "1")
                {
                    print("s   ------>   " + s);
                    //生成一个
                    GameObject o = GlobalTools.GetGameObjectByName(s);
                    if (o == null)
                    {
                        return;
                    }
                    string  posStr = strArr[i].Split('@')[1];
                    Vector2 pos    = new Vector2(float.Parse(posStr.Split('#')[0]), float.Parse(posStr.Split('#')[1]));
                    o.transform.position = pos;
                }
                else
                {
                    //状态=0 的时候 删除
                    if (GlobalTools.FindObjByName(s) != null)
                    {
                        GlobalTools.FindObjByName(s).GetComponent <Wupinlan>().DistorySelf();
                    }
                }
            }
            else if (sName == "G")
            {
                GameObject guai;
                if (GlobalDateControl.GetCGKName().Split('@').Length != 1)
                {
                    print(">>1");
                    guai = GlobalTools.FindObjByNameInRMaps(s);
                }
                else
                {
                    print(">>2");
                    //非生成地图
                    guai = GlobalTools.FindObjByName(s);
                }


                if (guai == null)
                {
                    print("******************************怪物名字    " + s);
                    guai = GlobalTools.FindObjByNameInGuais(s);
                    GlobalTools.FindObjByName("MainCamera").GetComponent <ScreenDoorGuaiControl>().TheGuaiList.Remove(guai);
                    if (guai)
                    {
                        guai.SetActive(false);
                    }
                    continue;
                }


                //要在 maps 里面找
                print("  >////////////////////guai sname   " + s + "   是否匹配到怪  " + guai);
                if (GuaiList.Count != 0 && guai != null)
                {
                    GuaiList.Remove(guai);
                    if (GlobalTools.FindObjByName("maps") && GlobalTools.FindObjByName("maps").GetComponent <GetReMap2>().GuaiList.Remove(guai))
                    {
                        guai.SetActive(false);
                    }
                    else
                    {
                        guai.SetActive(false);
                    }

                    CheckGuaiDoor();
                }
                else
                {
                    guai.SetActive(false);
                }
            }
            else if (sName == "JG")
            {
                //机关记录
                //JG_screenName-nums(数组位置)
                string ScreenName = strArr[i].Split('_')[1] + "_" + strArr[i].Split('_')[2].Split('-')[0];
                //print("ScreenName   "+ ScreenName);
                if (ScreenName == SceneManager.GetActiveScene().name)
                {
                    JGNum = int.Parse(strArr[i].Split('-')[1]);
                    //print("----------------------------  匹配!!!");
                }
            }
            else
            {
                print("其他记录    " + s);
                if (GlobalTools.FindObjByName(s) != null)
                {
                    GlobalTools.FindObjByName(s).SetActive(false);
                }
            }
        }
    }