Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - ricky

Pages: [1]
1
NGUI 3 Support / Re: How to get Sprite/Atlas selctor for a UISprite
« on: November 07, 2016, 01:00:46 AM »

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;


[CustomEditor(typeof(AchievementItem))]
public class AchievementItemEditor : Editor
{
    private SerializedProperty spriteName;


    void OnEnable()
    {
        spriteName = serializedObject.FindProperty("spriteName");
    }


    public override void OnInspectorGUI()
    {
        serializedObject.Update();
        DrawDefaultInspector();
        NGUIEditorTools.DrawSpriteField("Icon", spriteName.stringValue, NGUISettings.atlas, NGUISettings.selectedSprite, OnSprite, GUILayout.Width(120f));
        serializedObject.ApplyModifiedProperties();
    }


    void OnSprite(string val)
    {
        serializedObject.Update();
        Debug.Log("Called");
        spriteName.stringValue = val;
        serializedObject.ApplyModifiedProperties();
        Repaint();
    }
}


2
TNet 3 Support / persisting player.id e.g. to to save position on server?
« on: September 30, 2015, 12:54:18 PM »
Am i missing something extremely basic here or do I understand that the way TNet works out of the box, there is no saving position/etc of a player, if they disconnect/reconnect, the player will always get a new playerid when reconnecting to the server so their old SaveAll RFC will be lost.

If I want to persist that state, and save the player id, are there built in functions to do that?  Will the server also save the information permanently?

My idea setup is, make playerid SteamID, or subsstring of SteamID... however, it appears tnet always wants to create a new player.id on each client connection.  How can I search on the server, for a previous player id using an alias?  Right now, I just add player alias such as SteamID, but that obviously does nothing for a disconnect reconnect due to the playerid being new when client reconnects.

Where is the proper place to store these alias?  What functions should be called?  Will server save?  Client save?  Should I set playerid on the client, then connect like I set playername on the client?

3
Other Packages / Re: UI Starter Kit: Starlink (NGUI + TNet)
« on: August 21, 2015, 10:16:34 AM »
wow, i just randomly found the solution and better yet why the problem exists in the first place and I believe it's all in the order in which you import the packages.  Especially since this is an 'example' asset on how to use, this may be important for anyone else who runs into this problem.

Steps to reproduce:
Start with new empty project
Import Starlink UI project
Import NGUI
Open Menu scene
Import TNET starlink addon (menu scene will now reload)

..... Although compilation hasn't finished due to not having imported TNET yet, the problem might occur here.....

Import TNET.

Aftercompilation, an assignment is missing on one of the menu items.



Since I had never seen the asset before, how was I to know an assignment was missing there?  The misleading part was, there is nothing in the code on the actual button you press that would indicate the action is to be performed somewhere else, in another script and the script is attached to a completely different game object.

If I import TNET first before doing any other step, then import Starlink/TNET Integration/NGUI, there are no issues.

=D

4
Other Packages / Re: UI Starter Kit: Starlink (NGUI + TNet)
« on: August 21, 2015, 09:51:32 AM »
Did you add the scenes to the build list?

here is a screenshot of what is going on:


5
Other Packages / Re: UI Starter Kit: Starlink (NGUI + TNet)
« on: August 21, 2015, 09:39:34 AM »
yes i did, and it's still not working at all.  Is there any way you can explain what is supposed to be happening, behind the scenes, when you click that lan server join?  Or can I show you on twitch in a live demo of the event, and what's going on?

6
Other Packages / Re: UI Starter Kit: Starlink (NGUI + TNet)
« on: August 15, 2015, 05:41:17 AM »
sorry to revisit the lan issue again, but i'm having problem like previous user who made about 10 posts regarding the subject.

In the video, you click on Lan, start lan, then join the lan as host and it takes you to the next screen for game settings.

https://youtu.be/nNDKr716MT8?t=8m43s

That is not happening.

Followed step by step instructions, and can't get lan to work properly.  The lan window shows the server listed, when clicking on it, it says there is 1 client connected, when 2nd client clicks on it, it says there are 2 clients.

Neither the host or the client is sent to the next step.

Reiterating, the video shows the host start lan game, then, connect to it's own lan game, then immediately after connecting by clicking the server listed, the following occurs:

+Join Game
+Create
+New Game
Loads "Game Scene"

The current asset store package, never makes it to Join Game window, it just refreshes Server List window with number of clients connected to the LAN server that is made.

There are no errors displayed.

7
TNet 3 Support / Re: connected ... timed out ... disconnected
« on: September 25, 2014, 08:31:37 PM »
I'm not using any code yet, i'm following the video tutorial step by step, up to the point of just simply connecting using the TNAutoJoin component.  I have since uninstalled all instances of unity and reinstalled it, even the new version today.  Still the same problem.

8
TNet 3 Support / connected ... timed out ... disconnected
« on: September 24, 2014, 06:13:57 PM »
Greetings;

Following the making a game from scratch video tutorial, i'm stuck on a certain part.  server starts fine.  I have the 3 scenes with all required components.  Join, game & disconnected.

If I run from within the unity editor, the client appears as this on the server: (happens with remote server and local server)

23.xxx.xxx.xxx has connected
23.xxx.xxx.xxx has timed out
23.xxx.xxx.xxx has disconnected

There is no error or debug info in the client editor log about it... the editor simply stalls for a moment and loads the game scene for a split second, then drops to disconnected scene.

if I Build the client and connect... the client connects just as intended, this error is only happening in the editor with no apparent reasons that I can debug easily.

I've tried the following:
-Made sure that .NET subset is NOT selected.
-Various port # configs
-Restarting computer
-Disabling all network adapters not in use
-Run in Background is checked



9
NGUI 3 Support / Re: Label Resizing on Mobile incorrectly
« on: July 16, 2014, 05:19:10 PM »
Ok, so for whatever reason, after retrying the Camera gameobject as the anchor transform, it's now working.  I can deduct from the edges of the screen instead of only from the center.  Before, that option was grayed out so I could not adjust or change it from Center to the appropriate (LEFT, RIGHT, BOTTOM, TOP) anchor.

Thanks!

10
NGUI 3 Support / Re: Label Resizing on Mobile incorrectly
« on: July 16, 2014, 02:15:12 PM »
To anchor an object to all 4 sides of the screen, what is the Target supposed to be?  I tried Camera, which gives offset from screen, but it doesn't work on play at all, only in editor.  Putting any empty Anchor object, limits me to offset from the center of that object only.

11
NGUI 3 Support / Re: Label Resizing on Mobile incorrectly
« on: July 16, 2014, 02:08:54 PM »
the problem is, the label is a child of AnchorTop, which has an anchor for the top of the screen.  If I set the label to advanced anchor type, you cannot change what it is a target of, you only have the option for "Target's Center", which doesn't work.

I tried creating a transparent sprite object that resizes automatically, then, instead of using anchor, the target is now the sprite.

The problem is, now the sprite has a problem of connecting properly.

So, now I try to add UIStretch to the transparent sprite, then anchor the label to the sprite so I can actually select the offset from top,bottom, left, right, but the underlying sprite is still offscreen and I get the same problem as mentioned.

12
NGUI 3 Support / Re: Android Adreno issue
« on: July 15, 2014, 01:57:33 PM »
We had a HUGE project to update to 3.6.  It was time consuming, but the worst part, was learning the ins and outs of updating.  I know it seems like a monstrous task, but it is WELL WORTH THE UPGRADE!  Do yourself and your team a favor, make a plan to update to 3.6, the benefits outweight the work you have done previously, if you upgrade correctly.  Backup, Push and revert if problems arise, work out the kinks, then you will get through the upgrade.

Others commenting, might think an upgrade of that magnitude isn't worth it, but it's simpler than you might imagine or better yet, simpler than your first try!

13
NGUI 3 Support / Label Resizing on Mobile incorrectly
« on: July 15, 2014, 01:54:20 PM »
I have a label at top of screen, simply anchored to top of screen, it fills entire screen for story telling except for the bottom 10% of the screen. EVERYTHING works as expected, using Stretch (which I know is deprecated), but is only solution I could find, in "Editor Play mode, it works".

When pushed to mobile devices, the label is stretched beyond width of the screen in portrait mode, cutting off 10% on either side.

I have used anchors but they are completely 100% stationary.  Is there anything I'm missing here?  This is a screenshot of the desired result that works fine in editor, but published content just doesn't react the same.

Portrait Mode
http://image.com/dYXj6tW

Landscape Mode
http://imgur.com/2Ssa4oK

What is the proper solution to have a simple Label at top of screen to fill width and 90% of height that stretches in either landscape or portrait mode with 3.6+?

14
NGUI 3 Support / Re: 3.0.7f3 Upgrade, now TweenAlpha broken
« on: December 19, 2013, 03:45:59 PM »
You need to attach TweenAlpha to a widget or a panel. In your example you do msg.GetComponentInChildren<UILabel> -- I'm guessing your widget (label) is on a child object. This is the object you need to TweenAlpha.

Thanks!

I put the tween alpha on the children and removed it from the parent and it works fine now:

TweenAlpha[] tas = msg.GetComponentsInChildren<TweenAlpha>();
        foreach (TweenAlpha ta in tas)
        {
            ta.ResetToBeginning();
            ta.enabled = true;
        }

15
NGUI 3 Support / 3.0.7f3 Upgrade, now TweenAlpha broken
« on: December 18, 2013, 10:56:14 PM »
Is there a temporary fix for this issue?  I am having a problem with this update.  The errors with uirect and tweenalpha.  I'm not having problems with any other tweens.

I tried the thread http://www.tasharen.com/forum/index.php?topic=7210.0 but that did not help me, i am not adding a child or anything.  I'm simply doing what I did before, make the gameobject active, then get reference to the component, but for some reason, getcomponent does not work with this update with tweenalpha.  I have not changed any code and this coe has worked for a good 4 months now in the same project.

***Error***
NullReferenceException: Object reference not set to an instance of an object
TweenAlpha.set_value (Single value) (at Assets/NGUI/Scripts/Tweening/TweenAlpha.cs:35)
TweenAlpha.OnUpdate (Single factor, Boolean isFinished) (at Assets/NGUI/Scripts/Tweening/TweenAlpha.cs:41)
UITweener.Sample (Single factor, Boolean isFinished) (at Assets/NGUI/Scripts/Tweening/UITweener.cs:282)
UITweener.ResetToBeginning () (at Assets/NGUI/Scripts/Tweening/UITweener.cs:349)
MsgDisplay.ScheduledMessageDisplay (System.String message, MESSAGESTYLE messageStyle, System.String spriteName) (at Assets/Scripts/GUI/MsgDisplay.cs:56)
MsgDisplay.DisplayMessage (System.String message, MESSAGESTYLE messageStyle, System.String spriteName) (at Assets/Scripts/GUI/MsgDisplay.cs:76)
PlayerMovement.CheckVelocity () (at Assets/Scripts/PlayerMovement.cs:2260)
PlayerMovement.Update () (at Assets/Scripts/PlayerMovement.cs:596)

***Code***
 GameObject msg = msgs.Dequeue();
        msgs.Enqueue(msg);
        msg.SetActive(true);
        msg.GetComponent<TweenScale>().ResetToBeginning();
        msg.GetComponent<TweenScale>().enabled = true;
        msg.GetComponent<TweenPosition>().ResetToBeginning();
        msg.GetComponent<TweenPosition>().enabled = true;
        msg.GetComponent<TweenAlpha>().ResetToBeginning();
        msg.GetComponent<TweenAlpha>().enabled = true;
        float timeToDisplay = SetMessageStyle(messageStyle, msg);
        msg.GetComponentInChildren<UILabel>().text = message;

Pages: [1]