Author Topic: [WIP] C# (Edit)  (Read 1329 times)

0 Members and 1 Guest are viewing this topic.

JAZZ 0R KILLER

  • Member
  • ***
  • Posts: 115
  • YT - Solo Crew
  • Awards Top contributors to the forum downloads.
    • View Profile
    • YouTube
    • Awards
  • Xbox: JAZZ 0R KILLER
[WIP] C# (Edit)
« on: April 02, 2018, 08:30:46 PM »
Big shout out to Justyn! He has helped me with almost all of this project that I am working on.

I am working on a project that adds a sound effect to the game when a button is pressed. I got all the way up to the point to where you add the references, and you're supposed to add all the .dll files from the Total Miner directory. For some reason it doesn't let me add all of the .dlls, I get an error. Can someone help me out? What am I doing wrong?

Spoiler for Hidden Content:
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Input.Touch;
using Microsoft.Xna.Framework.Media;

namespace Sound_Effects_Mod
{
    public class Class1
    {
        SoundEffect[] SoundEffects;
        ITMGame gameVar;
        public void Draw(ITMPlayer player, ITMPlayer virtualPlayer)
        {

        }

        public void Initialize(ITMPluginManager agr, string path)
        {

        }

        public void InitializeGame(ITMGame game)
        {
            this.gameVar = game;
            this.SoundEffects = new SoundEffect[1];
            this.SoundEffects[0] = this.gameVar.AudioManager.LoadSoundEffectFromStream(@"C:\Users\First.Last\Desktop\Sound_Effects\Sound_Effect.wav");

        }

        public void PlayerJoined(ITMPlayer player)
        {

        }

        public void PlayerLeft(ITMPlayer player)
        {

        }

        public void Update(ITMPlayer player)
        {
            if (InputManager.IsKeyReleasedNew(player.PlayerIndex, Keys.N))
            {
                int index = this.gameVar.Random.Next(1, 1);
                this.SoundEffects[index].Play();
            }
        }

        public void Update()
        {

        }
    }
}
« Last Edit: April 06, 2018, 10:25:03 AM by JAZZ 0R KILLER »
Look at you being all cool!

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6655
  • Dig Deep
  • Awards Developer 5 years on site 4 years on site 3 years on site 2 years on site Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Re: C# (Need help)
« Reply #1 on: April 03, 2018, 08:39:57 AM »
What error? Do you mean the yellow icon next to the reference?

It's probably better to just copy the dll's from total miner directly to your bin folder and reference the dll's from there, or create a sub folder in your project, named Libs or something, and copy the dll's into there and reference them from there.

JAZZ 0R KILLER

  • Member
  • ***
  • Posts: 115
  • YT - Solo Crew
  • Awards Top contributors to the forum downloads.
    • View Profile
    • YouTube
    • Awards
  • Xbox: JAZZ 0R KILLER
Re: C# (Need help)
« Reply #2 on: April 03, 2018, 01:28:25 PM »
Im getting errors like this: Severity   Code   Description   Project   File   Line   Suppression State
Error   CS0234   The type or namespace name 'Touch' does not exist in the namespace 'Microsoft.Xna.Framework.Input' (are you missing an assembly reference?)   Noise effect Mod   C:\Users\My.Name\Documents\My Games\TotalMinerBeta\Mods\Noise effect Mod\Noise effect Mod\Noise effect Mod\Class1.cs   10   Active
Look at you being all cool!

JAZZ 0R KILLER

  • Member
  • ***
  • Posts: 115
  • YT - Solo Crew
  • Awards Top contributors to the forum downloads.
    • View Profile
    • YouTube
    • Awards
  • Xbox: JAZZ 0R KILLER
Re: C# (Need help)
« Reply #3 on: April 03, 2018, 01:31:13 PM »
I've tried adding all the .dlls from Total Miner directory to the references, almost all work, but CSteamworks, DSETUP, dsetup32, and steam_api wont load into the references. Also, where can I get the Total Miner plugins? That might contribute greatly to my problem
Look at you being all cool!

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6655
  • Dig Deep
  • Awards Developer 5 years on site 4 years on site 3 years on site 2 years on site Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Re: C# (Need help)
« Reply #4 on: April 03, 2018, 06:20:04 PM »
You don't need to add steamworks, dsetup etc, you only need to add whichever StudioForge, Microsoft.Xna and System assemblies your code will actually reference. See some of the examples here: https://github.com/cmartin99/TotalMinerMods

JAZZ 0R KILLER

  • Member
  • ***
  • Posts: 115
  • YT - Solo Crew
  • Awards Top contributors to the forum downloads.
    • View Profile
    • YouTube
    • Awards
  • Xbox: JAZZ 0R KILLER
Re: C# (Need help)
« Reply #5 on: April 03, 2018, 06:29:06 PM »
How do I see the references on these projects?
Look at you being all cool!

JAZZ 0R KILLER

  • Member
  • ***
  • Posts: 115
  • YT - Solo Crew
  • Awards Top contributors to the forum downloads.
    • View Profile
    • YouTube
    • Awards
  • Xbox: JAZZ 0R KILLER
Re: C# (Need help)
« Reply #6 on: April 03, 2018, 07:13:32 PM »
It says it can't find ITMPlayer, ITMGame, "The name InputManager does not exist" and 14 other errors
Look at you being all cool!

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6655
  • Dig Deep
  • Awards Developer 5 years on site 4 years on site 3 years on site 2 years on site Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Re: C# (Need help)
« Reply #7 on: April 03, 2018, 07:26:18 PM »
How do I see the references on these projects?
Download the solution and look at the projects in Visual Studio.

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6655
  • Dig Deep
  • Awards Developer 5 years on site 4 years on site 3 years on site 2 years on site Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Re: C# (Need help)
« Reply #8 on: April 03, 2018, 07:26:56 PM »
It says it can't find ITMPlayer, ITMGame, "The name InputManager does not exist" and 14 other errors
You need 'using' statements at top of source file. See the projects I posted above.

JAZZ 0R KILLER

  • Member
  • ***
  • Posts: 115
  • YT - Solo Crew
  • Awards Top contributors to the forum downloads.
    • View Profile
    • YouTube
    • Awards
  • Xbox: JAZZ 0R KILLER
Re: C# (Need help)
« Reply #9 on: April 03, 2018, 07:48:19 PM »
Okay, I've looked at some things. My mod folder for the mod I am trying to create only has Class1.cs of the cs files. And I also don't have the .dll file
Look at you being all cool!