Example #1
0
    void OnPopupOk(StoreConfirmParam parm)
    {
        C2G.StoreItemBuy packet = new C2G.StoreItemBuy();

        packet.store_id  = m_StoreID;
        packet.store_idx = m_StoreItem.store_idx;

        switch (m_StoreItem.item_type)
        {
        case pe_StoreItemType.Rune:
            RuneInfo rune_info = ItemInfoManager.Instance.GetInfoByIdn(m_StoreItem.item_idn) as RuneInfo;
            packet.rune_id = rune_info.ID;
            break;

        case pe_StoreItemType.Token:
            packet.goods = new pd_GoodsData((ItemInfoManager.Instance.GetInfoByIdn(m_StoreItem.item_idn) as TokenInfo).TokenType, m_StoreItem.item_count);
            break;

        case pe_StoreItemType.Creature:
            packet.creature_id    = CreatureInfoManager.Instance.GetInfoByIdn(m_StoreItem.item_idn).ID;
            packet.creature_grade = m_StoreItem.item_count;
            break;

        default:
            break;
        }

        Network.GameServer.JsonAsync <C2G.StoreItemBuy, C2G.StoreItemBuyAck>(packet, OnStoreItemBuy);
    }
Example #2
0
 public TravelContext(RunebookInfo book, RuneInfo rune, bool recall)
     : base((IEntity)book.Find(), false)
 {
     this.m_Book   = book;
     this.m_Rune   = rune;
     this.m_Recall = recall;
 }
 public PPE_InvokeRunebook(Item book, RuneInfo rune, bool recall)
     : base((byte)240)
 {
     this.m_Stream.Write((byte)3);
     this.m_Stream.Write(book.Serial);
     this.m_Stream.Write(recall ? (byte)0 : (byte)1);
     this.m_Stream.Write((short)rune.Point.X);
     this.m_Stream.Write((short)rune.Point.Y);
     this.m_Stream.Write((byte)rune.Facet);
 }
Example #4
0
    private void InitRunePathDictionary()
    {
        TextAsset    ta       = Resources.Load("RunePathInfo") as TextAsset;
        RuneInfoList infoList = JsonUtility.FromJson <RuneInfoList>(ta.text);

        for (int index = 0; index < infoList.infos.Count; index++)
        {
            RuneInfo   info       = infoList.infos[index];
            RunePrefab runePrefab = new RunePrefab(info);
            runePrefabs.Add(info.Name, runePrefab);
        }
    }
Example #5
0
    private RuneInfo GetRuneInfo()
    {
        RuneInfo rInfo = new RuneInfo();

        rInfo.Initialize(primaryRunePath.GetRunePathName(), secondaryRunePath.GetRunePathName());
        string[] strs = primaryRunePath.GetSelectedRunes();
        foreach (string str in strs)
        {
            rInfo.AddRuneStone(str);
        }
        strs = secondaryRunePath.GetSelectedRunes(false);
        foreach (string str in strs)
        {
            rInfo.AddRuneStone(str);
        }
        return(rInfo);
    }
Example #6
0
    public void Save()
    {
        RuneInfo rInfo = GetRuneInfo();

        userInfo.SetRuneInfo(rInfo);

        RunePathInfo rp_1 = primaryRunePath.GetPathInfo(true);
        RunePathInfo rp_2 = secondaryRunePath.GetPathInfo(false);

        string jsonStr_1 = JsonUtility.ToJson(RunePathInfo.RunePathInfo_to_RunePathData(rp_1, true), true);

        System.IO.File.WriteAllText(Application.streamingAssetsPath + "/SavedRunePages/" + userName + "/" + "PrimaryPath" + runePageSeletor.value + ".json", jsonStr_1);
        string jsonStr_2 = JsonUtility.ToJson(RunePathInfo.RunePathInfo_to_RunePathData(rp_2, true), true);

        System.IO.File.WriteAllText(Application.streamingAssetsPath + "/SavedRunePages/" + userName + "/" + "SecondaryPath" + runePageSeletor.value + ".json", jsonStr_2);

        Debug.Log("Saved RunePage exists: " + System.IO.File.Exists("Assets/StreamingAssets/" + "SavedRunePages/Annie/PrimaryPath0.json"));
        Debug.Log("RunePage Saved");
    }
Example #7
0
    void OnLootItem10(C2G.StoreLootItem10 packet, C2G.StoreLootItem10Ack ack)
    {
        Network.PlayerInfo.UseGoods(m_ItemLoot.Price);
        List <LootItemInfo> loot_item_infos = new List <LootItemInfo>();

        for (int i = 0; i < ack.loot_items.Count; ++i)
        {
            ItemManager.Instance.Add(ack.loot_items[i]);
            loot_item_infos.Add(new LootItemInfo(ack.loot_items[i].item_idn, ack.loot_items[i].add_piece_count));
        }
        for (int i = 0; i < ack.loot_runes.Count; ++i)
        {
            RuneManager.Instance.Add(ack.loot_runes[i]);
            RuneInfo rune_info = RuneInfoManager.Instance.GetRuneInfoByIdn(ack.loot_runes[i].rune_idn);
            loot_item_infos.Add(new LootItemInfo(ack.loot_runes[i].rune_idn, 0, rune_info.Grade > 3));
        }
        loot_item_infos = loot_item_infos.OrderBy(i => MNS.Random.Instance.Next()).ToList();
        //ItemManager.Instance.ItemMadeList.Clear();

        GameMain.Instance.UpdatePlayerInfo();

        Popup.Instance.Show(ePopupMode.LootItem10, loot_item_infos, this);
    }
Example #8
0
    public void showReloadScreen(int num)
    {
        pause = true;
        if (num == 1)
        {
            p1reload = true;
            foreach (GameObject g in bulletIndicators)
            {
                g.SetActive(true);
            }
            for (int i = 0; i < spellSlots.Count; i++)
            {
                spellSlots [i].GetComponent <Image> ().sprite = defaultSlot;
                spellSlots [i].GetComponent <Image> ().color  = Color.white;
            }
            for (int i = Temp.Count - 1; i > -1; i--)
            {
                if (Temp [i] != null)
                {
                    Temp.RemoveAt(i);
                }
                if (TempNum [i] != null)
                {
                    Handful.RemoveAt(TempNum [i]);
                    TempNum.RemoveAt(i);
                }
            }

            for (int i = 0; i < pauseObjects.Length; i++)
            {
                if (i < Handful.Count)
                {
                    pauseObjects [i].SetActive(true);
                }
                else
                {
                    pauseObjects [pauseObjects.Length - 1].SetActive(true);
                }
            }
            for (int i = 0; i < battleObjects.Length; i++)
            {
                if (battleObjects[i] != null)
                {
                    battleObjects [i].SetActive(false);
                }
            }
            for (int i = 0; i < pauseUI.Length; i++)
            {
                pauseUI [i].SetActive(true);
            }
            selectButton();
            for (int i = 0; i < spellHold.children.Count; i++)
            {
                Button b             = spellHold.children [i].gameObject.GetComponent <Button> ();
                int    currentHolder = i;
                b.onClick.RemoveAllListeners();
                b.onClick.AddListener(delegate { addBullet(currentHolder); });
                if (Handful.Count > i)
                {
                    GameObject curSpell = ((GameObject)Resources.Load(Handful [i].name));
                    curSpell.GetComponent <Spell> ().setDescription(player.weapon);
                    b.GetComponent <Image> ().sprite = curSpell.GetComponent <Spell> ().bulletImage;

                    if (b.GetComponent <Image> ().sprite.name == "Knob")
                    {
                        b.GetComponent <Image> ().color = curSpell.GetComponent <SpriteRenderer> ().color;
                    }
                    else
                    {
                        b.GetComponent <Image> ().color = Color.white;
                    }

                    RuneInfo r = spellHold.children [i].gameObject.GetComponent <RuneInfo> ();
                    r.runeName   = curSpell.GetComponent <Spell>().name;
                    r.runeImage  = curSpell.GetComponent <Spell> ().runeImage;
                    r.runeDamage = curSpell.GetComponent <Spell>().damage.ToString();
                    r.runeDesc   = curSpell.GetComponent <Spell> ().description;
                }
            }
        }
        else
        {
            p2reload = true;
            foreach (GameObject g in bulletIndicators_2)
            {
                g.SetActive(true);
            }
            for (int i = 0; i < spellSlots_2.Count; i++)
            {
                spellSlots_2[i].GetComponent <Image>().sprite = defaultSlot;
                spellSlots_2[i].GetComponent <Image>().color  = Color.white;
            }
            for (int i = Temp_2.Count - 1; i > -1; i--)
            {
                if (Temp_2 [i] != null)
                {
                    Temp_2.RemoveAt(i);
                }
                if (TempNum_2 [i] != null)
                {
                    Handful_2.RemoveAt(TempNum_2 [i]);
                    TempNum_2.RemoveAt(i);
                }
            }
            for (int i = 0; i < pauseObjects_p2.Length; i++)
            {
                if (i < Handful_2.Count)
                {
                    pauseObjects_p2 [i].SetActive(true);
                }
                else
                {
                    pauseObjects_p2 [pauseObjects.Length - 1].SetActive(true);
                }
            }
            for (int i = 0; i < battleObjects_2.Length; i++)
            {
                if (battleObjects_2[i] != null)
                {
                    battleObjects_2 [i].SetActive(false);
                }
            }
            for (int i = 0; i < pauseUI_2.Length; i++)
            {
                pauseUI_2 [i].SetActive(true);
            }
            selectButton_2();
            for (int i = 0; i < spellHold_2.children.Count; i++)
            {
                Button b             = spellHold_2.children [i].gameObject.GetComponent <Button> ();
                int    currentHolder = i;
                b.onClick.RemoveAllListeners();
                b.onClick.AddListener(delegate { addBullet_2(currentHolder); });
                if (Handful_2.Count > i)
                {
                    GameObject curSpell = ((GameObject)Resources.Load(Handful_2 [i].name));
                    curSpell.GetComponent <Spell> ().setDescription(player2.weapon);
                    b.GetComponent <Image> ().sprite = curSpell.GetComponent <Spell> ().bulletImage;

                    if (b.GetComponent <Image> ().sprite.name == "Knob")
                    {
                        b.GetComponent <Image> ().color = curSpell.GetComponent <SpriteRenderer> ().color;
                    }
                    else
                    {
                        b.GetComponent <Image> ().color = Color.white;
                    }

                    RuneInfo r = spellHold_2.children [i].gameObject.GetComponent <RuneInfo> ();
                    r.runeName   = curSpell.GetComponent <Spell>().name;
                    r.runeImage  = curSpell.GetComponent <Spell> ().runeImage;
                    r.runeDamage = curSpell.GetComponent <Spell>().damage.ToString();
                    r.runeDesc   = curSpell.GetComponent <Spell> ().description;
                }
            }
        }
    }
    public RuneInfo LoadRuneInfo(string heroName)
    {
        RuneInfo runeInfo = new RuneInfo();

        string        priP       = "";
        string        secP       = "";
        string        keyStone   = "";
        List <string> runeStones = new List <string>();

        string path_pri;
        string path_sec;

#if UNITY_EDITOR || UNITY_STANDALONE_WIN
        path_pri = Application.streamingAssetsPath + "/SavedRunePages/" + heroName + "/PrimaryPath0.json";
        if (File.Exists(path_pri))
        {
            string dataAsJson;
            dataAsJson = File.ReadAllText(path_pri);
            RunePathData runePathData = new RunePathData();
            runePathData = JsonUtility.FromJson <RunePathData>(dataAsJson);
            Debug.Log("Found Saved RunePage at " + path_pri);
            GameDebugUtility.AddDebugMsg("Found Saved RunePage at " + path_pri);
            priP     = runePathData.pathName;
            keyStone = runePathData.keyStone.stoneChoiced;
            foreach (RuneStone rs in runePathData.runeStones)
            {
                runeStones.Add(rs.stoneChoiced);
            }
        }
        else
        {
            Debug.LogError("No saved RunePage");
        }
        path_sec = Application.streamingAssetsPath + "/SavedRunePages/" + heroName + "/SecondaryPath0.json";
        if (File.Exists(path_sec))
        {
            string dataAsJson;
            dataAsJson = File.ReadAllText(path_sec);
            RunePathData runePathData = new RunePathData();
            runePathData = JsonUtility.FromJson <RunePathData>(dataAsJson);
            Debug.Log("Found Saved RunePage at " + path_sec);
            GameDebugUtility.AddDebugMsg("Found Saved RunePage at " + path_sec);
            secP = runePathData.pathName;
            foreach (RuneStone rs in runePathData.runeStones)
            {
                runeStones.Add(rs.stoneChoiced);
            }
        }
        else
        {
            Debug.LogError("No saved RunePage");
        }
#endif

#if UNITY_ANDROID
        if (Application.platform == RuntimePlatform.Android)//Unknown bug in reading the files
        {
            string dataAsJson;
            path_pri = Path.Combine(Application.streamingAssetsPath + "/", heroName + "/PrimaryPath0.json");
            Debug.Assert(File.Exists(path_pri));
            WWW reader = new WWW(path_pri);
            while (!reader.isDone)
            {
            }
            dataAsJson = reader.text;
            RunePathData runePathData = new RunePathData();
            runePathData = JsonUtility.FromJson <RunePathData>(dataAsJson);
            Debug.Log("Found Saved RunePage at " + path_pri);

            priP     = runePathData.pathName;
            keyStone = runePathData.keyStone.stoneChoiced;
            foreach (RuneStone rs in runePathData.runeStones)
            {
                runeStones.Add(rs.stoneChoiced);
            }


            path_sec = Path.Combine(Application.streamingAssetsPath + "/", heroName + "/SecondaryPath0.json");
            reader   = new WWW(path_sec);
            while (!reader.isDone)
            {
            }
            dataAsJson   = reader.text;
            runePathData = new RunePathData();
            runePathData = JsonUtility.FromJson <RunePathData>(dataAsJson);
            Debug.Log("Found Saved RunePage at " + path_sec);

            secP = runePathData.pathName;
            foreach (RuneStone rs in runePathData.runeStones)
            {
                runeStones.Add(rs.stoneChoiced);
            }
        }
#endif
        runeInfo.Initialize(priP, secP);
        runeInfo.AddRuneStone(keyStone);
        foreach (string s in runeStones)
        {
            runeInfo.AddRuneStone(s);
        }

        return(runeInfo);
    }
 public void SetRuneInfo(RuneInfo runeInfo)
 {
     this.runeInfo = runeInfo;
 }
Example #11
0
    public string GetName()
    {
        RuneInfo rune_info = Info as RuneInfo;

        return(Localization.Format("RuneTitle", Info.Name, Level, rune_info.GradeInfo.MaxLevel));
    }
Example #12
0
 public RunePrefab(RuneInfo info)
 {
     Icon   = Resources.Load <Sprite>(info.IconPath);
     Prefab = Resources.Load <GameObject>(info.PrefabPath);
 }
Example #13
0
    //REnables the UI for the reload menu
    public void showReloadScreen()
    {
        //resets the bottle indicators of bullet number
        foreach (GameObject g in bulletIndicators)
        {
            g.SetActive(true);
        }
        //resets the default staus to the rune holding ui
        for (int i = 0; i < spellSlots.Count; i++)
        {
            spellSlots[i].GetComponent <Image>().sprite = defaultSlot;
            spellSlots[i].GetComponent <Image>().color  = Color.white;
        }

        //removes the bullets used in the last round from the deck
        for (int i = Temp.Count - 1; i > -1; i--)
        {
            if (Temp [i] != null)
            {
                Temp.RemoveAt(i);
            }
            if (TempNum [i] != null)
            {
                Handful.RemoveAt(TempNum [i]);
                TempNum.RemoveAt(i);
            }
        }
        //reenables the UI for the reload screen
        for (int i = 0; i < pauseObjects.Length; i++)
        {
            if (i < Handful.Count)
            {
                pauseObjects [i].SetActive(true);
            }
            else
            {
                pauseObjects [pauseObjects.Length - 1].SetActive(true);
            }
        }

        //DEactivates the UI for the battle screen
        for (int i = 0; i < battleObjects.Length; i++)
        {
            if (battleObjects[i] != null)
            {
                battleObjects [i].SetActive(false);
            }
        }

        //reenables the UI for the reload screen
        for (int i = 0; i < pauseUI.Length; i++)
        {
            pauseUI [i].SetActive(true);
        }

        //Selects the proper button
        selectButton();
        pause = true;

        //Sets each spell holder to a match the spell from the deck.
        for (int i = 0; i < spellHold.children.Count; i++)
        {
            Button b             = spellHold.children [i].gameObject.GetComponent <Button> ();
            int    currentHolder = i;
            b.onClick.RemoveAllListeners();
            b.onClick.AddListener(delegate { addBullet(currentHolder); });
            if (Handful.Count > i)
            {
                GameObject curSpell = ((GameObject)Resources.Load(Handful [i].name));
                curSpell.GetComponent <Spell> ().setDescription(player.weapon);
                b.GetComponent <Image> ().sprite = curSpell.GetComponent <Spell> ().bulletImage;
                if (b.GetComponent <Image> ().sprite.name == "Knob")
                {
                    b.GetComponent <Image> ().color = curSpell.GetComponent <SpriteRenderer> ().color;
                }
                else
                {
                    b.GetComponent <Image> ().color = Color.white;
                }
                RuneInfo r = spellHold.children [i].gameObject.GetComponent <RuneInfo> ();
                r.runeName   = curSpell.GetComponent <Spell>().name;
                r.runeImage  = curSpell.GetComponent <Spell> ().runeImage;
                r.runeDesc   = curSpell.GetComponent <Spell> ().description;
                r.runeDamage = curSpell.GetComponent <Spell>().damage.ToString();
            }
        }

        //Sets the player's reload value to false preventing it from reactivating the reload screen immediately
        player.reload = false;
    }