public String IconImageDataUri(S.AppWindow self)
 {
     var key = "IconImageDataUri-" + self.HWnd;
     var iconImageDataUri = System.Runtime.Caching.MemoryCache.Default.Get(key) as String; ;
     if (iconImageDataUri == null)
     {
         var iconImage = self.IconImage;
         try
         {
             using (MemoryStream memoryStream = new MemoryStream())
             {
                 BitmapEncoder encoder = new PngBitmapEncoder();
                 encoder.Frames.Add(BitmapFrame.Create(iconImage));
                 encoder.Save(memoryStream);
                 var b64String = Convert.ToBase64String(memoryStream.ToArray());
                 iconImageDataUri = "data:image/png;base64," + b64String;
                 System.Runtime.Caching.MemoryCache.Default.Add(key, iconImageDataUri, DateTimeOffset.Now.AddHours(1));
             } 
         }
         catch {
             return null;
         }
     }
     return iconImageDataUri;
 }
Exemple #2
0
 public void destroyScene()
 {
     Destroy(GameObject.Find("FightSceneHolder").gameObject);
     Switcheroo.reEnable();
 }
Exemple #3
0
 public void EnterShowroom()
 {
     Switcheroo.disable();
     Application.LoadLevelAdditive(3);
 }
Exemple #4
0
    void Update()
    {
        if (!inDungeon)
        {
            //The character is on the world map.
            nodes = GameObject.FindGameObjectsWithTag("Node");

            switch (nodes[worldID].GetComponent <branchMapGen>().nodeType)
            {
            case branchMapGen.NodeType.TOWN:
                interactText.text = "Enter Town";
                break;

            case branchMapGen.NodeType.DUNGEON:
                interactText.text = "Enter Dungeon";
                break;

            default:
                interactText.text = "Nothing Here";
                break;
            }

            if (nodes.Length > 0)
            {
                //Only set next node to this if you are not on the last node.
                if (worldID < nodes.Length - 1)
                {
                    nextNode = nodes[worldID + 1];
                }

                if (worldID == 0)
                {
                    transform.position = nodes[0].transform.position;
                }

                //Set the player position to the current node.
                transform.position = Vector3.MoveTowards(transform.position, nodes[worldID].transform.position, .1f);
                Vector3 temp = transform.position;
                temp.z             = -0.1f;
                transform.position = temp;

                //Check if the node has an event
                if (nodes[worldID].GetComponent <branchMapGen>().hasEvent == true)
                {
                    Debug.Log("This node has an event!");
                }

                //Draw the next cost on screen.
                nextStepCost.text = "Next Step Cost: " + nextNode.GetComponent <branchMapGen>().stepCost.ToString();
            }
        }
        else
        {
            //The character is in a dungeon.

            interactText.text = "Exit Dungeon";

            dungeonNodes = GameObject.FindGameObjectsWithTag("DungeonNode");

            foreach (GameObject node in dungeonNodes)
            {
                if (node.GetComponent <branchMapGen>().u_id == dungeonID)
                {
                    switch (node.GetComponent <branchMapGen>().nodeType)
                    {
                    case branchMapGen.NodeType.ITEM:
                        if (node.GetComponent <branchMapGen>().hasBeenUsed == false)
                        {
                            Debug.Log("This is an item");
                            node.GetComponent <itemGenerator>().GrantItem();
                            node.GetComponent <branchMapGen>().hasBeenUsed = true;
                        }
                        else
                        {
                            Debug.Log("Nothing Here");
                        }
                        break;

                    case branchMapGen.NodeType.ENEMY:
                        if (node.GetComponent <branchMapGen>().hasBeenUsed == false)
                        {
                            Debug.Log("This is a battle");
                            Switcheroo.disable();
                            Application.LoadLevelAdditive("battleTest");
                            node.GetComponent <branchMapGen>().hasBeenUsed = true;
                        }
                        break;

                    default:
                        break;
                    }
                }
            }

            if (dungeonNodes.Length > 0)
            {
                //Only set next node to this if you are not on the last node.
                if (dungeonID < dungeonNodes.Length - 1)
                {
                    nextDungeonNode = dungeonNodes[dungeonID + 1];
                }

                //Set the player position to the current node.
                foreach (GameObject node in dungeonNodes)
                {
                    if (node.GetComponent <branchMapGen>().u_id == dungeonID)
                    {
                        transform.position = Vector3.MoveTowards(transform.position, node.transform.position, .1f);
                    }
                }
                //transform.position = Vector3.MoveTowards(transform.position, dungeonNodes[dungeonID].transform.position, .5f);
                Vector3 temp = transform.position;
                temp.z             = -0.1f;
                transform.position = temp;

                //Check if the node has an event

                /*
                 * if(dungeonNodes[dungeonID].GetComponent<branchMapGen>().hasEvent == true){
                 *      Debug.Log ("This node has an event!");
                 * }
                 */

                //Draw the next cost on screen.
                nextStepCost.text = "Next Step Cost: " + nextDungeonNode.GetComponent <branchMapGen>().stepCost.ToString();
            }
        }
    }