Ejemplo n.º 1
0
 public void OnPointerClick(PointerEventData eventData)
 {
     if (i < Globals.dialogs.Count - 1)
     {
         UIManager.ChangeText("context", "");
         Globals.logIndex = i;
         ChatFuncs.Instance.ShowDialog(i);
         i++;
     }
     else
     {
         if (Globals.lastScene == "Login")
         {
             Globals.nextScene = "Main";
         }
         if (Globals.lastScene == "Room")
         {
             GameFuncs.GoToScene("Room");
         }
         else
         {
             GameFuncs.GoToSceneAsync(Globals.nextScene);
         }
     }
 }
Ejemplo n.º 2
0
 void OnstoryBtnClick(string dialogPath)
 {
     MusicManager.PlaySe("click");
     Globals.currentDialog = dialogPath;
     Globals.nextScene     = "Room";
     GameFuncs.GoToScene("Chat");
 }
Ejemplo n.º 3
0
 void OnplaceBtnClick(string index)
 {
     MusicManager.PlaySe("click");
     //Change Love
     RoomGlobals.loveDic[RoomGlobals.currentId].love += int.Parse(index) * 10;
     if (RoomGlobals.loveDic[RoomGlobals.currentId].love >= RoomGlobals.loveDic[RoomGlobals.currentId].maxLove)
     {
         RoomGlobals.loveDic[RoomGlobals.currentId].lv++;
         RoomGlobals.loveDic[RoomGlobals.currentId].love -= RoomGlobals.loveDic[RoomGlobals.currentId].maxLove;
     }
     //Load Dialogs
     Globals.currentDialog = RoomGlobals.currentId + "_date" + index;
     //Globals.lastScene = "Room";
     GameFuncs.GoToScene("Chat");
 }
Ejemplo n.º 4
0
    void OnchatBtnClick()
    {
        MusicManager.PlaySe("click");
        parent = transform.parent;
        string id     = GameFuncs.GetId(parent.transform);
        int    indexs = 0;

        foreach (var dialog in Resources.LoadAll("Dialogs"))
        {
            if (dialog.name.Contains(id) && dialog.name.Contains("chat"))
            {
                indexs++;
            }
        }
        Globals.currentDialog = id + "_chat" + Random.Range(1, indexs + 1);
        GameFuncs.GoToScene("Chat");
    }
Ejemplo n.º 5
0
    // Use this for initialization
    void Start()
    {
        //ui
        UIManager.ChangeText("energyText", Globals.player.energy.ToString() + "/" + Globals.player.maxEnergy);
        UIManager.ChangeSlider("energySlider", (float)Globals.player.energy / Globals.player.maxEnergy);
        //get place
        Transform grid = GameObject.Find("grid").transform;

        foreach (Transform place in grid)
        {
            place.GetComponent <Button>().onClick.AddListener(() =>
            {
                BattleGlobals.placeName = place.gameObject.name[place.gameObject.name.Length - 1].ToString();
                GameFuncs.GoToScene("SelectHero");
            });
        }
    }
Ejemplo n.º 6
0
 void OnskipBtnClick()
 {
     //PlaySE
     MusicManager.PlaySe("click");
     //Go to next scene(stop at options)
     if (Globals.lastScene == "Login")
     {
         Globals.nextScene = "Main";
     }
     if (Globals.lastScene == "Room")
     {
         GameFuncs.GoToScene("Room");
     }
     else
     {
         GameFuncs.GoToSceneAsync(Globals.nextScene);
     }
 }
Ejemplo n.º 7
0
    // Use this for initialization
    void Start()
    {
        heroPre = (GameObject)GameFuncs.GetResource("Prefabs/hero");
        Transform selectGrid = GameObject.Find("selectGrid").transform;
        Transform heroes     = GameObject.Find("heroes").transform;

        //Load selectToggles
        selectToggles = selectGrid.GetComponentsInChildren <Toggle>(false);
        foreach (Toggle t in selectToggles)
        {
            t.onValueChanged.AddListener((bool isOn) => { OnselectToggleClick(t, isOn); });
        }
        currentToggle = selectToggles[0];
        //Load eleToggles
        Toggle[] eleToggles = heroes.GetComponentsInChildren <Toggle>(false);
        foreach (Toggle t in eleToggles)
        {
            t.onValueChanged.AddListener((bool isOn) => { OneleToggleClick(t, isOn); });
        }
        //Show All Heroes
        foreach (Toggle t in eleToggles)
        {
            string     eleName         = t.gameObject.name.Replace("Toggle", "");
            string     panelParentName = eleName + "PanelParent";
            GameObject panel           = GameFuncs.FindHiden(panelParentName);
            Transform  grid            = panel.transform.Find(eleName + "Grid");
            ShowHeroes(eleName, grid);
            grids.Add(grid);
        }
        UIManager.ChangeText("energyText", Globals.player.energy.ToString() + "/" + Globals.player.maxEnergy);
        UIManager.ChangeSlider("energySlider", (float)Globals.player.energy / Globals.player.maxEnergy);
        Button goBtn = UIManager.GetButton("goBtn");

        goBtn.onClick.AddListener(OngoBtnClick);
        Button backBtn = UIManager.GetButton("backBtn");

        backBtn.onClick.AddListener(() => {
            GameFuncs.GoToScene("SelectBattleMap");
        });
    }
Ejemplo n.º 8
0
 void OnbackBtnClick()
 {
     GameFuncs.GoToScene("Room");
 }
Ejemplo n.º 9
0
 void OnheroBtnClick(string id)
 {
     MusicManager.PlaySe("click");
     HeroGlobals.currentid = id;
     GameFuncs.GoToScene("HeroInfo");
 }
Ejemplo n.º 10
0
 void OndateBtnClick()
 {
     MusicManager.PlaySe("click");
     GameFuncs.GoToScene("SelectDateMap");
 }
Ejemplo n.º 11
0
    // Use this for initialization
    void Start()
    {
        //Load Hero
        string id = HeroGlobals.currentid;

        for (int i = 0; i < Globals.heroes.Count; i++)
        {
            if (Globals.heroes[i].id == id)
            {
                currentHero = Globals.heroes[i];
            }
        }
        Transform  point = GameObject.Find("point").transform;
        GameObject hero  = Instantiate((GameObject)GameFuncs.GetResource("Prefabs/" + id), point);

        hero.AddComponent <OnHeroInfoModel>();
        hero.GetComponent <Rigidbody>().useGravity = false;
        //Load Toggle
        Toggle[] toggles = GameObject.FindObjectsOfType <Toggle>();
        foreach (Toggle t in toggles)
        {
            t.onValueChanged.AddListener((bool isOn) => { OninfoToggleClick(t, isOn); });
        }
        foreach (Toggle t in toggles)
        {
            string infoName        = t.gameObject.name.Replace("Toggle", "");
            string panelParentName = infoName + "PanelParent";
            panel = GameFuncs.FindHiden(panelParentName).transform;
            //Load All
            if (infoName == "all")
            {
                ShowAll(panel);
                //Bind Btns
                Button upBtn    = UIManager.GetButton("upBtn");
                Button breakBtn = UIManager.GetButton("breakBtn");
                upBtn.onClick.AddListener(() =>
                {
                    MusicManager.PlaySe("click");
                    if (Globals.player.gold >= 100)
                    {
                        if (HeroGlobals.upItemCount > 0)
                        {
                            //values
                            currentHero.exps[1] += 10;
                            HeroGlobals.upItemCount--;
                            Globals.player.gold -= 100;
                            for (int i = 0; i < Globals.items.Count; i++)
                            {
                                if (Globals.items[i].itemId == "001")//合成剂
                                {
                                    Globals.items[i].count = HeroGlobals.upItemCount;
                                }
                            }
                            if (currentHero.exps[1] >= currentHero.exps[2])//lv up
                            {
                                currentHero.exps[0]++;
                                for (int i = 0; i < currentHero.infos.Length; i++)
                                {
                                    currentHero.infos[i] += (currentHero.exps[0] - 1) * 1;
                                }
                                currentHero.exps[1] -= currentHero.exps[2];
                                currentHero.exps[2] += (currentHero.exps[0] - 1) * 100;
                            }
                            ShowAll(panel);
                        }
                        else
                        {
                            GameFuncs.CreateMsg("合成剂不足!");
                        }
                    }
                    else
                    {
                        GameFuncs.CreateMsg("金币不足!");
                    }
                });
                breakBtn.onClick.AddListener(() =>
                {
                    MusicManager.PlaySe("click");
                    if (Globals.player.gold >= 1000)
                    {
                        if (HeroGlobals.breakItemCount > 0)
                        {
                            //values
                            currentHero.exps[0]++;
                            for (int i = 0; i < currentHero.infos.Length; i++)
                            {
                                currentHero.infos[i] += (currentHero.exps[0] - 1) * 1;
                            }
                            HeroGlobals.breakItemCount--;
                            for (int i = 0; i < Globals.items.Count; i++)
                            {
                                if (Globals.items[i].itemId == "003")//突破晶石
                                {
                                    Globals.items[i].count = HeroGlobals.breakItemCount;
                                }
                            }
                            Globals.player.gold -= 1000;
                            currentHero.exps[1]  = 0;
                            currentHero.exps[2] += (currentHero.exps[0] - 1) * 100;
                            //add skill
                            foreach (Skill s in Globals.skillList)
                            {
                                if (!currentHero.skills.Contains(s))
                                {
                                    if (!s.isCp && s.ele == currentHero.ele && s.lv <= currentHero.exps[0])    //学会
                                    {
                                        currentHero.skills.Add(s);
                                        currentHero.skills.Sort();
                                        GameFuncs.CreateMsg("学会[" + s.sname + "]技能!");
                                        CreateSkill(s);
                                    }
                                }
                            }
                            ShowAll(panel);
                        }
                        else
                        {
                            GameFuncs.CreateMsg("突破晶石不足!");
                        }
                    }
                    else
                    {
                        GameFuncs.CreateMsg("金币不足!");
                    }
                });
            }
            //Load Skill
            else if (infoName == "skill")
            {
                skillGrid = panel.Find("list/grid");
                infoText  = panel.Find("infoText").GetComponent <Text>();
                List <Skill> skills = currentHero.skills;
                skills.Sort();
                //skills.Add(currentHero.superSkill);
                for (int i = 0; i < skills.Count; i++)
                {
                    Skill s = skills[i];
                    CreateSkill(s);
                }
            }
            //Load Dresses
            else if (infoName == "dress")
            {
                Image  image    = panel.Find("Image").GetComponent <Image>();
                Text   text     = panel.Find("Text").GetComponent <Text>();
                Button imageBtn = panel.Find("Image").GetComponent <Button>();
                Button nextBtn  = panel.Find("nextBtn").GetComponent <Button>();
                nextBtn.interactable = dressIndex < currentHero.dresses.Count - 1 ? true : false;
                Button preBtn = panel.Find("preBtn").GetComponent <Button>();
                preBtn.interactable = dressIndex > 0 ? true : false;
                nextBtn.onClick.AddListener(() => {
                    MusicManager.PlaySe("click");
                    if (dressIndex < currentHero.dresses.Count - 1)
                    {
                        dressIndex++;
                    }
                });
                nextBtn.onClick.AddListener(() => {
                    MusicManager.PlaySe("click");
                    if (dressIndex > 0)
                    {
                        dressIndex--;
                    }
                });
                image.sprite = Resources.Load <Sprite>("Character/Portrait/" + currentHero.dresses[0].imagePath);
                text.text    = currentHero.dresses[0].dname;
                imageBtn.onClick.AddListener(() => { OndressBtnClick("Prefabs/" + currentHero.dresses[0].modelPath); });
            }
        }
        Button setHeadBtn = UIManager.GetButton("setHeadBtn");//弹出对话框

        setHeadBtn.onClick.AddListener(() => {
            MusicManager.PlaySe("click");
            GameFuncs.CreateMsg("设为首席成功!");
            Globals.player.characterId = currentHero.id;
        });
        Button backBtn = UIManager.GetButton("backBtn");

        backBtn.onClick.AddListener(() => { GameFuncs.GoToScene("Heroes"); });
    }
Ejemplo n.º 12
0
 void OnsettingBtnClick()
 {
     MusicManager.PlaySe("click");
     GameFuncs.GoToScene("Setting");
 }
Ejemplo n.º 13
0
 void OnpackBtnClick()
 {
     MusicManager.PlaySe("click");
     GameFuncs.GoToScene("Pack");
 }