Example #1
0
    public void SetSpell(int id, AvailableSpells aSpell)
    {
        if (id >= GetMaxSpells() || id < 0)
        {
            id = 0;
        }

        // Every spell must have an script attached here
        Spell spell;

        switch (aSpell)
        {
        case AvailableSpells.SPELL_FIREBALL:
            spell = gameObject.AddComponent <Fireball>();
            break;

        // Return if spell does not exist
        default:
            Debug.Log("Tried setting spell " + aSpell + "at id " + ", but does not exist.");
            return;
        }

        Spells[id] = spell;

        MyUI.SetSpellIcon(id, spell.GetIcon());
    }
Example #2
0
    protected override void ShowMenu()
    {
        //print("ShowMenu");
        //GameManager._instance.isEditing = true;
        //GameManager._instance.activeObject = gameObject;

        scaleSys.GetComponent <ScaleSys>().maxSacle = maxScale;
        SetScaleSys();
        SetDirectionSys();
        MyUI ui = myUI.GetComponent <MyUI>();

        ui.SetDeleteButton(true);
        ui.ShowMenuByName(fieldType + "Menu");

        float elecRange   = maxElec - minElec;
        float elecVal     = (electric - minElec) / elecRange;
        float magnRange   = maxMagn - minMagn;
        float magnVal     = (magnetic - minMagn) / magnRange;
        float rotationVal = transform.localEulerAngles.y / 360;

        //elecMenu.SetActive(true);
        SetMenu(true);
        FindComponents();
        SetListeners();

        elecText.text     = electric.ToString();
        elecBar.value     = elecVal;
        magnText.text     = magnetic.ToString();
        magnBar.value     = magnVal;
        magnToggle.isOn   = magUp;
        rotationText.text = (Mathf.Floor(transform.localEulerAngles.y)).ToString();
        rotationBar.value = rotationVal;
    }
Example #3
0
    protected override void ShowMenu()
    {
        //GameManager._instance.isEditing = true;
        //GameManager._instance.activeObject = gameObject;

        scaleSys.GetComponent <ScaleSys>().maxSacle = maxScale;
        SetScaleSys();
        MyUI ui = myUI.GetComponent <MyUI>();

        ui.SetDeleteButton(true);
        ui.ShowMenuByName(fieldType + "Menu");
        SetMenu(true);
        FindComponents();
        SetListeners();

        float MGRange    = maxMG - minMG;
        float attenRange = maxAtten - minAtten;
        float MGVar      = (fieldMassXG - minMG) / MGRange;
        float attenVar   = (attenuation - minAtten) / attenRange;

        MGText.text    = fieldMassXG.ToString();
        MGBar.value    = MGVar;
        attenText.text = attenuation.ToString();
        attenBar.value = attenVar;
    }
Example #4
0
    protected override void ShowMenu()
    {
        //GameManager._instance.isEditing = true;
        //GameManager._instance.activeObject = gameObject;

        scaleSys.GetComponent <ScaleSys>().maxSacle = maxScale;
        SetScaleSys();
        MyUI ui = myUI.GetComponent <MyUI>();

        ui.SetDeleteButton(true);
        ui.ShowMenuByName(fieldType + "Menu");
        SetMenu(true);
        FindComponents();
        SetListeners();

        float acceRange = maxAcceleration - minAcceleration;
        float acceVar   = (acceleration - minAcceleration) / acceRange;

        acceText.text = acceleration.ToString();
        acceBar.value = acceVar;

        rotationBar.value = transform.localEulerAngles.y / 360;
        rotationText.text = Mathf.Floor(transform.localEulerAngles.y).ToString();

        positiveToggle.isOn = isPositive;
    }
Example #5
0
    public void SwitchUI(UIType type)
    {
        if (_lastActiveUI != null)
        {
            _lastActiveUI.gameObject.SetActive(false);
        }

        if (type == UIType.NULL)
        {
            return;
        }

        MyUI desiredUI = _myUIList.Find(x => x.menuType == type);

        if (desiredUI != null)
        {
            desiredUI.gameObject.SetActive(true);
            _previousUI   = _lastActiveUI;
            _lastActiveUI = desiredUI;
        }
        else
        {
            Debug.LogWarning("Not found");
        }
    }
Example #6
0
 private void Start()
 {
     _myUIList = GetComponentsInChildren <MyUI>().ToList();
     _myUIList.ForEach(x => x.gameObject.SetActive(false));
     _gameplayUI = _myUIList.Find(x => x.menuType == UIType.GAMEUI);
     SwitchUI(UIType.MAINMENU);
 }
Example #7
0
 public void DecativateUI()
 {
     if (_lastActiveUI != null)
     {
         _lastActiveUI.gameObject.SetActive(false);
         _lastActiveUI = null;
         _previousUI   = null;
     }
 }
Example #8
0
 public void GoToPreviousUI()
 {
     if (_lastActiveUI != null)
     {
         _lastActiveUI.gameObject.SetActive(false);
         _previousUI.gameObject.SetActive(true);
         _lastActiveUI = _previousUI;
     }
 }
Example #9
0
    public void SetMaxHealth(int value)
    {
        if (value < 1)
        {
            value = 1;
        }

        MaxHealth = value;

        MyUI.UpdateMaxHealth();
    }
Example #10
0
 // Use this for initialization
 void Start()
 {
     scaleSys    = GameObject.Find("ScaleSys");
     rotationSys = GameObject.Find("RotationSys");
     UIScript    = GameObject.Find("Canvas").GetComponent <MyUI>();
     //print(rotationSys.name);
     if (GameManager.editMode)
     {
         editable = true;
     }
     else
     {
         editable = false;
     }
 }
Example #11
0
    // initialization
    private void Start()
    {
        ui  = FindObjectOfType(typeof(MyUI)) as MyUI;
        lvl = FindObjectOfType(typeof(level2)) as level2;
        map = transform.parent.GetComponent <Map>();
        GameObject tmp = Instantiate(ballObject, new Vector3(transform.position.x - 2, -94, transform.position.z), Quaternion.identity) as GameObject;

        ball = tmp.GetComponent <Ball>();
        ball.setColor(map.getColor());
        GameObject tmp2 = Instantiate(ballObject, new Vector3(30, -117, 0), Quaternion.identity) as GameObject;

        ballWait = tmp2.GetComponent <Ball>();
        ballWait.setColor(map.getColor());
        angle = new Vector2(0f, 1f);
        ui.Display(true);
    }
Example #12
0
 /// <summary>
 /// MenuItem5 click event: will show a input box to update a new interval
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private static void IconMenuClickEvent5(object sender, System.EventArgs e)
 {
     if (JobRunning)
     {
         MyNotification.Push(localeM.GetString("WaitBackground"), localeM.GetString("IntervalWillShow"));
     }
     myTimer.AutoReset = false;
     while (JobRunning)
     {
         System.Threading.Thread.Sleep(50);
     }
     if (MyUI.IntervalInput(UpdateInterval, out long newInterval) == DialogResult.OK)
     {
         UpdateInterval = newInterval;
     }
     myTimer.Interval = UpdateInterval;
     myTimer.Start();
 }
Example #13
0
 private bool DeleteEnvir(Envir env)
 {
     if (env != null)
     {
         if (!Envirs.Delete(env))
         {
             System.Console.WriteLine("Не найден Envir в массиве");
             return(false);
         }
         if (!MyMap.DeleteEnvir(env))
         {
             System.Console.WriteLine("Не найден Envir в карте!");
             return(false);
         }
         MyUI.DelActor(env);
         env.Dispose();
     }
     return(true);
 }
    void Start()
    {
        Harmony.CreateAndPatchAll(typeof(CopyPlanetFactory), null);
        readFile();
        haveStyle.fontSize         = 15;
        noStyle.fontSize           = 15;
        haveStyle.normal.textColor = new Color(255f, 255f, 255f);
        noStyle.normal.textColor   = new Color(255f / 256f, 77f / 256f, 77f / 256f);
        windowsBorder = new Texture2D(826, 525);
        windowsBorder.LoadImage(Convert.FromBase64String(MyResources.WindowsBorder));
        //windowContent.image = windowsBorder;
        windowStyle.fontSize = 15;
        var res = AssetBundle.LoadFromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("CopyPlanetFactory.copyplanetallui"));

        ui         = new MyUI(res.LoadAsset <GameObject> ("GameObject"));
        rectImg    = new RectImg();
        BuildName  = new Dictionary <string, int>();
        RecipeName = new Dictionary <string, int>();
    }
Example #15
0
        private bool DeleteAnim(Animal anm)
        {
            if (anm != null)
            {
                if (!Animals.Delete(anm))
                {
                    System.Console.WriteLine("Не найден anim в массиве");
                    return(false);
                }
                if (!MyMap.DeleteAnim(anm))
                {
                    System.Console.WriteLine("Не найден Anim в карте");
                    return(false);
                }

                MyUI.DelActor(anm);
                anm.Dispose();
            }
            return(true);
        }
Example #16
0
    public void SetHealth(int value)
    {
        if (value > MaxHealth)
        {
            value = MaxHealth;
        }
        else if (value < 0)
        {
            value = 0;
        }

        Health = value;

        MyUI.UpdateHealth();

        if (Health <= 0)
        {
            Game.GameOver();
        }
    }
Example #17
0
    protected override void ShowMenu()
    {
        //GameManager._instance.isEditing = true;
        //GameManager._instance.activeObject = gameObject;
        scaleSys.GetComponent <ScaleSys>().maxSacle = maxScale;
        SetScaleSys();

        MyUI ui = myUI.GetComponent <MyUI>();

        ui.SetDeleteButton(true);
        ui.ShowMenuByName(fieldType + "Menu");
        float rotationVal = transform.localEulerAngles.y / 360;

        //teleMenu.SetActive(true);
        SetMenu(true);
        FindComponents();
        SetListeners();

        rotationText.text = (Mathf.Floor(transform.localEulerAngles.y)).ToString();
        rotationBar.value = rotationVal;
    }
Example #18
0
 public void SetАction()
 {
     MyUI.SetActive(false);
     MyUI.GetPanel();
 }
Example #19
0
 public void HidePanelFail()
 {
     MyUI.HidePanelFail();
 }
Example #20
0
 public void OnMouseDown()
 {
     Debug.Log("asdasd");
     MyUI.SetActive(true);
 }
Example #21
0
    public static void SetScore(int value)
    {
        Score = value;

        MyUI.UpdateScore(Score);
    }
Example #22
0
 // Start is called before the first frame update
 void Start()
 {
     // PurpleGames.Print();
     MyUI.DoUI();
 }
Example #23
0
 void Start()
 {
     myUI = canvas.GetComponent <MyUI>();
 }
Example #24
0
    public static void AddScore(int value)
    {
        Score += value;

        MyUI.UpdateScore(Score);
    }
Example #25
0
 public void GetPanelFail()
 {
     MyUI.SetActive(false);
     MyUI.GetPanelFail();
 }
Example #26
0
    // Start is called before the first frame update

    void Start()
    {
        MyUI.DoUI();
    }