Exemplo n.º 1
0
        internal void RPCCreateMarketStand(int itemID, Vector3 pos, int cost, bool isBuild, bool isCredits, bool isTrophies, NetworkViewID viewID)
        {
            ItemInfo    item      = ItemRegistry.Singleton[ItemRegistry.Singleton.ConvertIDToLocal(itemID)];
            GameObject  shopStand = Instantiate(SceneInjector.BuildStand, SceneInjector.BuildStand.transform.parent);
            NetworkView view      = shopStand.GetComponent <NetworkView>();

            if (view == null)
            {
                view = shopStand.AddComponent <NetworkView>();
            }
            view.viewID = viewID;
            shopStand.transform.localPosition = new Vector3(pos.x, pos.y, SceneInjector.BuildStand.transform.position.z);
            shopStand.name = isBuild ? "buildStand" : "kylockeStand";
            KylockeStand standScript = shopStand.GetComponent <KylockeStand>();

            standScript.isTrophies = isTrophies;
            standScript.isCredits  = isCredits;
            standScript.isBuild    = isBuild;
            standScript.itemID     = item.ID;
            standScript.cost       = cost;
            standScript.currency.GetComponent <MeshRenderer>().material = isBuild ? isCredits ? isTrophies ? GadgetCoreAPI.GetItemMaterial(59) : GadgetCoreAPI.GetItemMaterial(52) : GadgetCoreAPI.GetItemMaterial(57) : GadgetCoreAPI.GetItemMaterial(51);
            standScript.icon.GetComponent <MeshRenderer>().material     = item.Mat;
            standScript.txtName[0].text = item.GetName();
            standScript.txtName[1].text = standScript.txtName[0].text;
            standScript.txtCost[0].text = string.Empty + standScript.cost;
            standScript.txtCost[1].text = standScript.txtCost[0].text;
        }
Exemplo n.º 2
0
        internal GameObject CreateMarketStand(ItemInfo item, Vector2 pos, int cost, bool isBuild, bool isCredits, bool isTrophies)
        {
            Vector3       pos3d  = new Vector3(pos.x, pos.y, SceneInjector.BuildStand.transform.position.z);
            NetworkViewID viewID = Network.AllocateViewID();

            Singleton.GetComponent <NetworkView>().RPC("RPCCreateMarketStand", RPCMode.OthersBuffered, item.GetHostID(), pos3d, cost, isBuild, isCredits, isTrophies, viewID);
            GameObject  shopStand = Instantiate(SceneInjector.BuildStand, SceneInjector.BuildStand.transform.parent);
            NetworkView view      = shopStand.GetComponent <NetworkView>();

            if (view == null)
            {
                view = shopStand.AddComponent <NetworkView>();
            }
            view.viewID = viewID;
            shopStand.transform.localPosition = pos3d;
            shopStand.name = isBuild ? "buildStand" : "kylockeStand";
            KylockeStand standScript = shopStand.GetComponent <KylockeStand>();

            standScript.isTrophies = isTrophies;
            standScript.isCredits  = isCredits;
            standScript.isBuild    = isBuild;
            standScript.itemID     = item.ID;
            standScript.cost       = cost;
            standScript.currency.GetComponent <MeshRenderer>().material = isBuild ? isCredits ? isTrophies ? GadgetCoreAPI.GetItemMaterial(59) : GadgetCoreAPI.GetItemMaterial(52) : GadgetCoreAPI.GetItemMaterial(57) : GadgetCoreAPI.GetItemMaterial(51);
            standScript.icon.GetComponent <MeshRenderer>().material     = item.Mat;
            standScript.txtName[0].text = item.GetName();
            standScript.txtName[1].text = standScript.txtName[0].text;
            standScript.txtCost[0].text = string.Empty + standScript.cost;
            standScript.txtCost[1].text = standScript.txtCost[0].text;
            return(shopStand);
        }
Exemplo n.º 3
0
        internal void RPCCreateMarketStand(int itemID, Vector3 pos, int cost, bool isBuild, bool isCredits, bool isTrophies, NetworkViewID viewID)
        {
            if (!GadgetNetwork.MatrixReady && GadgetNetwork.GetTimeSinceConnect() < GadgetNetwork.MatrixTimeout)
            {
                StartCoroutine(GadgetUtils.WaitAndInvoke(typeof(RPCHooks).GetMethod("RPCCreateMarketStand", BindingFlags.NonPublic | BindingFlags.Instance), GadgetNetwork.MatrixTimeout - GadgetNetwork.GetTimeSinceConnect(), () => GadgetNetwork.MatrixReady, this, itemID, pos, cost, isBuild, isCredits, isTrophies, viewID));
                return;
            }
            ItemInfo    item      = ItemRegistry.Singleton[ItemRegistry.Singleton.ConvertIDToLocal(itemID)];
            GameObject  shopStand = Instantiate(SceneInjector.BuildStand, SceneInjector.BuildStand.transform.parent);
            NetworkView view      = shopStand.GetComponent <NetworkView>();

            if (view == null)
            {
                view = shopStand.AddComponent <NetworkView>();
            }
            view.viewID = viewID;
            shopStand.transform.localPosition = new Vector3(pos.x, pos.y, SceneInjector.BuildStand.transform.position.z);
            shopStand.name = isBuild ? "buildStand" : "kylockeStand";
            KylockeStand standScript = shopStand.GetComponent <KylockeStand>();

            standScript.isTrophies = isTrophies;
            standScript.isCredits  = isCredits;
            standScript.isBuild    = isBuild;
            standScript.itemID     = item.ID;
            standScript.cost       = cost;
            standScript.currency.GetComponent <MeshRenderer>().material = isBuild ? isCredits ? isTrophies ? GadgetCoreAPI.GetItemMaterial(59) : GadgetCoreAPI.GetItemMaterial(52) : GadgetCoreAPI.GetItemMaterial(57) : GadgetCoreAPI.GetItemMaterial(51);
            standScript.icon.GetComponent <MeshRenderer>().material     = item.Mat;
            standScript.txtName[0].text = item.GetName();
            standScript.txtName[1].text = standScript.txtName[0].text;
            standScript.txtCost[0].text = string.Empty + standScript.cost;
            standScript.txtCost[1].text = standScript.txtCost[0].text;
        }
 public static bool Prefix(KylockeStand __instance, ref int[] p)
 {
     if (!GadgetNetwork.MatrixReady && GadgetNetwork.GetTimeSinceConnect() < GadgetNetwork.MatrixTimeout)
     {
         __instance.StartCoroutine(GadgetUtils.WaitAndInvoke(RPCMethod, GadgetNetwork.MatrixTimeout - GadgetNetwork.GetTimeSinceConnect(), () => GadgetNetwork.MatrixReady, __instance, p));
         return(false);
     }
     GadgetNetwork.ConvertIDToLocal(ItemRegistry.Singleton, ref p[0]);
     return(true);
 }
 public static void ReportKylockeError(KylockeStand stand)
 {
     if (stand.isCredits)
     {
         if (stand.isTrophies)
         {
             GameObject gameObject = (GameObject)Object.Instantiate(Resources.Load("txtError"), MenuScript.player.transform.position, Quaternion.identity);
             gameObject.SendMessage("InitError", "Insufficient Wealth Trophies!");
         }
         else
         {
             GameObject gameObject = (GameObject)Object.Instantiate(Resources.Load("txtError"), MenuScript.player.transform.position, Quaternion.identity);
             gameObject.SendMessage("InitError", "Insufficient Credits!");
         }
     }
     else
     {
         GameObject gameObject = (GameObject)Object.Instantiate(Resources.Load("txtError"), MenuScript.player.transform.position, Quaternion.identity);
         gameObject.SendMessage("InitError", "Insufficient Scrap Metal!");
     }
 }